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: [PATCH] Async signal safe TLS accesses


On Thu, 9 Jan 2014, Paul Pluzhnikov wrote:

> What about the race I posited as possible explanation? Do you agree that there
> is a race? Does sleep(1) before dlclose() "fix" it?

I agree there is a race, and the sleep does fix it (of course it also 
makes the test very slow).

Maybe have the signal handler outside the loaded module call the function 
from the loaded module, but with sem_post in the function outside the 
module?  I haven't tested whether this fixes the powerpc problem, but it 
should avoid the identified race with the module being dlclosed while code 
from it is executing.  (There would of course then be the need to have 
memory barriers to ensure the current pointer obtained from dlsym is 
available from the thread calling the signal handler - and it would be 
necessary to ensure that the test does still show up the non-signal-safety 
if run with older glibc.)

> Also, is the crash you are seeing intermittent (how frequent?) or reliable?

The crash is reliable.

-- 
Joseph S. Myers
joseph@codesourcery.com


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