This is the mail archive of the libc-alpha@sourceware.org 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: Specific Linux syscalls for glibc API


On Thu, Nov 19, 2015 at 07:21:13AM +0000, Warlich, Christof wrote:
> On 18-11-2015 14:32, Rich Felker wrote:
> 
> > It should be noted that there are some serious caveats to using tids
> > directly. Unlike pthread_t, a tid is immediately freed and available
> > for reuse as soon as the thread exits. This means additional
> > synchronization with the target thread's exit is required to avoid
> > TOCTOU races when use them.
> 
> I'm not sure if I really got your point here. While there is no doubt that
> synchronization _is_ needed if a tid must never be used after it has become
> invalid (due to the exit of its related thread), I don't see much of a risk
> that a tid value might be reused by a newly created thread any time soon:
> AFAIK, newly allocated tids are, like pids, always incremented. Thus, a
> tid reuse can only happen after wrapping around.

It's easy to force rapid tid reuse just by exhausting the tid/pid
namespace. Applications that assume this does not happen are
vulnerable to attacker-created situations where it does without
further hardening against the issue at the system level.

Rich


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