This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] Set default stack size from program environment

On 9 March 2013 05:12, Roland McGrath <> wrote:
> My core objection is to adding a magic environment variable that can affect
> everybody everywhere.  That just sets off lots of alarm bells and is almost
> the antithesis of conservative change.
> I recommended adding the API call first because it is a reasonably
> conservative change, and it lays groundwork for considering more radical
> changes later.  That is still my position.  To be more concrete, here's
> what I suggest:
> 1. Add an API call, with tests, etc.  We can review this on mundane
>    technical details of the implementation.  I expect that will go
>    quickly and have little difficulty reaching consensual approval.

OK, I'll do this next week.

> 2. Demonstrate other ideas by writing one or more preload modules that work
>    by using this new call.  LD_PRELOAD and /etc/ are existing
>    known quantities that paranoid people already know to be paranoid about.
>    This could be the end of it, if whoever wanted this feature in the first
>    place is happy enough writing their own preload module to implement it.

This was the first thing I had thought of - interposing pthread_create
to call pthread_attr_set_stacksize in the module.  That was however
rejected as being hacky and 'having to be maintained by *them*

>    However, I am unlikely to object to having a canonical module that is
>    maintained in libc and installed normally by libc, and that works by
>    consulting environment variables and/or system-wide configuration files.
>    Then use of this could be something like:
>         export LD_PRELOAD=${LD_PRELOAD:+${LD_PRELOAD}:}'/$LIB/'
>         export GNU_THREAD_STACK_SIZE=0x1000000
>    or similarly for /etc/ and whatever system-wide
>    configuration file you want to use.
>   Let people use these preload methods for a while in real-world
>   situations.  If people come back with complaints that this is
>   insufficient, suboptimal, or onerous in some regard, then we can
>   reconsider the issue in the context of that real-world experience.

How about extending this idea to have a module to configure all major
pthread default attributes (stacksize, guardsize, detachstate,
schedpolicy, schedparam, etc.) so that it's not just a
stacksize-specific hack?  I was toying with this idea as part of
libpthread, but I guess putting it in a module is a better idea. That
way, not wanting this customization comes with no penalty.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]