glibc/scripts
Alexey Makhalov cebcb9f864 Fix range check in do_tunable_update_val
Current implementation of tunables does not set arena_max and arena_test
values. Any value provided by glibc.malloc.arena_max and
glibc.malloc.arena_test parameters is ignored.

These tunables have minval value set to 1 (see elf/dl-tunables.list file)
and undefined maxval value. In that case default value (which is 0. see
scripts/gen-tunables.awk) is being used to set maxval.

For instance, generated tunable_list[] entry for arena_max is:
(gdb) p *cur
$1 = {name = 0x7ffff7df6217 "glibc.malloc.arena_max",
 type = {type_code = TUNABLE_TYPE_SIZE_T, min = 1, max = 0},
  val = {numval = 0, strval = 0x0}, initialized = false,
   security_level = TUNABLE_SECLEVEL_SXID_IGNORE,
    env_alias = 0x7ffff7df622e "MALLOC_ARENA_MAX"}

As a result, any value of glibc.malloc.arena_max is ignored by
TUNABLE_SET_VAL_IF_VALID_RANGE macro
  __type min = (__cur)->type.min;                    <- initialized to 1
  __type max = (__cur)->type.max;                    <- initialized to 0!
  if (min == max)                                    <- false
    {
      min = __default_min;
      max = __default_max;
    }
  if ((__type) (__val) >= min && (__type) (val) <= max)  <- false
    {
      (__cur)->val.numval = val;
      (__cur)->initialized = true;
    }

Assigning correct min/max values at a build time fixes a problem.
Plus, a bit of optimization: Setting of default min/max values for the
given type at a run time might be eliminated.

	* elf/dl-tunables.c (do_tunable_update_val): Range checking fix.
	* scripts/gen-tunables.awk: Set unspecified minval and/or maxval
	values to correct default value for given type.
2017-09-27 02:44:09 +05:30
..
abi-versions.awk
abilist.awk
backport-support.sh
build-many-glibcs.py Use MPFR 3.1.6 in build-many-glibcs.py. 2017-09-07 14:50:32 +00:00
check-c++-types.sh
check-execstack.awk
check-installed-headers.sh
check-local-headers.sh
check-localplt.awk
check-textrel.awk
config-uname.sh
config.guess
config.sub
cpp
cross-test-ssh.sh
documented.sh
evaluate-test.sh
firstversions.awk
gen-as-const.awk
gen-libc-abis
gen-libc-modules.awk
gen-posix-conf-vars.awk
gen-py-const.awk
gen-rrtypes.py
gen-sorted.awk
gen-tunables.awk Fix range check in do_tunable_update_val 2017-09-27 02:44:09 +05:30
install-sh
lib-names.awk
list-fixed-bugs.py
list-sources.sh
localplt.awk
merge-test-results.sh
mkinstalldirs
move-if-change
output-format.sed
pylint
pylintrc
rellns-sh
soversions.awk
sysd-rules.awk
test_printers_common.py
test_printers_exceptions.py
test-installation.pl
update-abilist.sh
update-copyrights
versionlist.awk
versions.awk