diff options
author | Alexey Makhalov <amakhalov@vmware.com> | 2017-09-27 02:44:09 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2017-09-27 02:44:09 +0530 |
commit | cebcb9f864d4ca29e155363e71b7de6826d13cf1 (patch) | |
tree | 5e2b25a46cbcb31b4a5e280db71641b8d7df22bf /conform | |
parent | 592d5c75392e1da170050a4999af0618c4865aed (diff) | |
download | glibc-cebcb9f864d4ca29e155363e71b7de6826d13cf1.tar.gz glibc-cebcb9f864d4ca29e155363e71b7de6826d13cf1.tar.xz glibc-cebcb9f864d4ca29e155363e71b7de6826d13cf1.zip |
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.
Diffstat (limited to 'conform')
0 files changed, 0 insertions, 0 deletions