From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27443 invoked by alias); 26 Sep 2017 18:54:58 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 27429 invoked by uid 89); 26 Sep 2017 18:54:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy=H*RU:sk:homiema, HX-HELO:sk:homiema, H*r:sk:homiema, Hx-spam-relays-external:sk:homiema X-HELO: homiemail-a92.g.dreamhost.com Subject: Re: [PATCH] Fix range check in do_tunable_update_val To: Alexey Makhalov , carlos@redhat.com Cc: libc-alpha@sourceware.org References: <20170926183807.31788-1-amakhalov@vmware.com> From: Siddhesh Poyarekar Message-ID: Date: Tue, 26 Sep 2017 18:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170926183807.31788-1-amakhalov@vmware.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-09/txt/msg00982.txt.bz2 On Wednesday 27 September 2017 12:08 AM, Alexey Makhalov wrote: > 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. Thanks for the patch. Can you please clarify the status of your copyright assignment (and Carlos verify it please)? I don't have access to the copyright assignment list, so once that question is cleared, I'll test and merge this patch. Siddhesh