diff mbox series

tunables: Disallow negative values for some tunables

Message ID 20210205080929.3316869-1-siddhesh@sourceware.org
State Superseded
Headers show
Series tunables: Disallow negative values for some tunables | expand

Commit Message

Siddhesh Poyarekar Feb. 5, 2021, 8:09 a.m. UTC
The glibc.malloc.mmap_max tunable as well as al of the INT_32 tunables
don't have use for negative values, so pin the hardcoded limits in the
non-negative range of INT.  There's no real benefit in any of those
use cases for the extended range of unsigned, so I have avoided added
a new type to keep things simple.
---
 elf/dl-tunables.list | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Carlos O'Donell Feb. 10, 2021, 12:57 p.m. UTC | #1
On 2/5/21 3:09 AM, Siddhesh Poyarekar via Libc-alpha wrote:
> The glibc.malloc.mmap_max tunable as well as al of the INT_32 tunables
> don't have use for negative values, so pin the hardcoded limits in the
> non-negative range of INT.  There's no real benefit in any of those
> use cases for the extended range of unsigned, so I have avoided added
> a new type to keep things simple.

LGTM.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  elf/dl-tunables.list | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/elf/dl-tunables.list b/elf/dl-tunables.list
> index 3cf0ad83ec..8ddd4a2314 100644
> --- a/elf/dl-tunables.list
> +++ b/elf/dl-tunables.list
> @@ -64,6 +64,7 @@ glibc {
>        type: INT_32
>        env_alias: MALLOC_MMAP_MAX_
>        security_level: SXID_IGNORE
> +      minval: 0
>      }
>      arena_max {
>        type: SIZE_T
> @@ -109,22 +110,27 @@ glibc {
>      skip_lock_busy {
>        type: INT_32
>        default: 3
> +      minval: 0
>      }
>      skip_lock_internal_abort {
>        type: INT_32
>        default: 3
> +      minval: 0
>      }
>      skip_lock_after_retries {
>        type: INT_32
>        default: 3
> +      minval: 0
>      }
>      tries {
>        type: INT_32
>        default: 3
> +      minval: 0
>      }
>      skip_trylock_internal_abort {
>        type: INT_32
>        default: 3
> +      minval: 0
>      }
>    }
>  
>
diff mbox series

Patch

diff --git a/elf/dl-tunables.list b/elf/dl-tunables.list
index 3cf0ad83ec..8ddd4a2314 100644
--- a/elf/dl-tunables.list
+++ b/elf/dl-tunables.list
@@ -64,6 +64,7 @@  glibc {
       type: INT_32
       env_alias: MALLOC_MMAP_MAX_
       security_level: SXID_IGNORE
+      minval: 0
     }
     arena_max {
       type: SIZE_T
@@ -109,22 +110,27 @@  glibc {
     skip_lock_busy {
       type: INT_32
       default: 3
+      minval: 0
     }
     skip_lock_internal_abort {
       type: INT_32
       default: 3
+      minval: 0
     }
     skip_lock_after_retries {
       type: INT_32
       default: 3
+      minval: 0
     }
     tries {
       type: INT_32
       default: 3
+      minval: 0
     }
     skip_trylock_internal_abort {
       type: INT_32
       default: 3
+      minval: 0
     }
   }