[PATCH] Check whether pthread_mutex_lock() and nanosleep() are included in libc before trying pthreads and rt

Nikos Mavrogiannopoulos nmav at redhat.com
Tue Dec 3 14:58:33 PST 2013


On Mon, 2013-12-02 at 15:30 +0100, Stef Walter wrote:
> On 30.11.2013 16:19, Nikos Mavrogiannopoulos wrote:
> > On Thu, 2013-11-28 at 16:34 +0100, Nikos Mavrogiannopoulos wrote:
> >> [resent]
> >>
> >> This is also related to:
> >> https://bugzilla.redhat.com/show_bug.cgi?id=877421
> >>
> >> Although it's for gnutls the same argumentation applies :)
> > 
> > I realized that you use pthread_atfork() so anyway you need to link to
> > libpthread. 
> > 
> > btw. Does p11-kit reinitialize automatically the modules after fork?
> 
> No, we just synchronize our internal state. Calling C_Initialize on in
> pthread_atfork() is pretty wild. Most uses of fork() are fork/exec.
> Besides not being async-signal-safe, many C_Initialize's are large
> blocking pieces of code.

Since you already detect fork in p11-kit could there be a
p11_kit_fork_detected() function that would return true if a fork has
been detected and the pkcs#11 libraries were not yet initialized?
That way a constrained API (like GnuTLS') could use it perform automatic
reinitialization.

regards,
Nikos




More information about the p11-glue mailing list