public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@gotplt.org>
To: Alexey Makhalov <amakhalov@vmware.com>, carlos@redhat.com
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] Fix range check in do_tunable_update_val
Date: Tue, 26 Sep 2017 18:54:00 -0000	[thread overview]
Message-ID: <bc9f895c-75d7-f5e9-7cf2-45634052c9c7@gotplt.org> (raw)
In-Reply-To: <20170926183807.31788-1-amakhalov@vmware.com>

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

  reply	other threads:[~2017-09-26 18:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26 18:38 Alexey Makhalov
2017-09-26 18:54 ` Siddhesh Poyarekar [this message]
2017-09-26 20:07   ` Carlos O'Donell
2017-09-26 21:17     ` Siddhesh Poyarekar
  -- strict thread matches above, loose matches on Subject: below --
2017-07-19 21:34 Alexey Makhalov
2017-07-20  1:43 ` Carlos O'Donell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc9f895c-75d7-f5e9-7cf2-45634052c9c7@gotplt.org \
    --to=siddhesh@gotplt.org \
    --cc=amakhalov@vmware.com \
    --cc=carlos@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).