tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [RFC][PATCH] _UC_TLSBASE for all ports

Matt Thomas <> wrote:

> if you start using using another thread's stack, you are assuming
> the identity of that thread.

It is some part of its identity, but not all. Another important part of
the thread identity is given by pthread_self(). That is used to ensure
mutexes, locks and conditions work. If you screw pthread_self() as we
allow by default, horrible things happens. For instance, malloc can be
re-entered by two threads, leading to unpleasant crashes.

Having a thread to grab the stack of another one is harmless, and we
even have at least one program (glusterfs) that makes use of it. Messing
with value returned by pthread_self() will lead to chaos. 

I just propose to add an option to avoid that. I have trouble to
understand why it meets such a resistance, since most of our ports
already have that option available. I just add missing bits.

Emmanuel Dreyfus

Home | Main Index | Thread Index | Old Index