public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] tunables: Disallow negative values for some tunables
@ 2021-02-05  8:41 Siddhesh Poyarekar
  2021-02-10 13:04 ` Carlos O'Donell
  0 siblings, 1 reply; 2+ messages in thread
From: Siddhesh Poyarekar @ 2021-02-05  8:41 UTC (permalink / raw)
  To: libc-alpha

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.
---

Change from v1: Fix tst-rtld-list-tunables.exp.

 elf/dl-tunables.list           | 6 ++++++
 elf/tst-rtld-list-tunables.exp | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

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 --git a/elf/tst-rtld-list-tunables.exp b/elf/tst-rtld-list-tunables.exp
index 4f3f7ee4e3..9f66c52885 100644
--- a/elf/tst-rtld-list-tunables.exp
+++ b/elf/tst-rtld-list-tunables.exp
@@ -1,7 +1,7 @@
 glibc.malloc.arena_max: 0x0 (min: 0x1, max: 0x[f]+)
 glibc.malloc.arena_test: 0x0 (min: 0x1, max: 0x[f]+)
 glibc.malloc.check: 0 (min: 0, max: 3)
-glibc.malloc.mmap_max: 0 (min: -2147483648, max: 2147483647)
+glibc.malloc.mmap_max: 0 (min: 0, max: 2147483647)
 glibc.malloc.mmap_threshold: 0x0 (min: 0x0, max: 0x[f]+)
 glibc.malloc.mxfast: 0x0 (min: 0x0, max: 0x[f]+)
 glibc.malloc.perturb: 0 (min: 0, max: 255)
-- 
2.29.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] tunables: Disallow negative values for some tunables
  2021-02-05  8:41 [PATCH v2] tunables: Disallow negative values for some tunables Siddhesh Poyarekar
@ 2021-02-10 13:04 ` Carlos O'Donell
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos O'Donell @ 2021-02-10 13:04 UTC (permalink / raw)
  To: Siddhesh Poyarekar, libc-alpha

On 2/5/21 3:41 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.

I already ack'd the v1, which I thought was good.

LGTM.

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

> ---
> 
> Change from v1: Fix tst-rtld-list-tunables.exp.
> 
>  elf/dl-tunables.list           | 6 ++++++
>  elf/tst-rtld-list-tunables.exp | 2 +-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> 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

OK.

>      }
>    }
>  
> diff --git a/elf/tst-rtld-list-tunables.exp b/elf/tst-rtld-list-tunables.exp
> index 4f3f7ee4e3..9f66c52885 100644
> --- a/elf/tst-rtld-list-tunables.exp
> +++ b/elf/tst-rtld-list-tunables.exp
> @@ -1,7 +1,7 @@
>  glibc.malloc.arena_max: 0x0 (min: 0x1, max: 0x[f]+)
>  glibc.malloc.arena_test: 0x0 (min: 0x1, max: 0x[f]+)
>  glibc.malloc.check: 0 (min: 0, max: 3)
> -glibc.malloc.mmap_max: 0 (min: -2147483648, max: 2147483647)
> +glibc.malloc.mmap_max: 0 (min: 0, max: 2147483647)

OK. Yes, the -nve range is silly.

>  glibc.malloc.mmap_threshold: 0x0 (min: 0x0, max: 0x[f]+)
>  glibc.malloc.mxfast: 0x0 (min: 0x0, max: 0x[f]+)
>  glibc.malloc.perturb: 0 (min: 0, max: 255)
> 


-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-10 13:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05  8:41 [PATCH v2] tunables: Disallow negative values for some tunables Siddhesh Poyarekar
2021-02-10 13:04 ` Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).