tech-pkg archive

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

pthreads and the pkgsrc build environment



I am having a problem with security/pkcs11-helper (and a proprietary
pkcs11 module).  The essence of the issue is that the process is
threaded, pkcs11-helper is built with threads, and after a fork the
pthread_atfork child handler runs, and it does operations which are not
async-signal safe.  This leads, as threatened in the spec, to undefined
behavior :-(

See
  http://pubs.opengroup.org/onlinepubs/009604599/functions/fork.html
for how restricted post-fork operations are in threaded processes.
(These restrictions date to the 1997 SUS!)

So, there are two issues:

  Should pkcs11-helper be 'fixed' to be non-threaded in pkgsrc?  I think
  so, but that's for another message.

  The security/pkcs11-helper pkgsrc definition does not mention
  pthreads.  But, configure checks for pthreads, and not only uses them
  but turns on some defines that changes code (pthread_atfork, mutexes).


On the detection issue:

  I think it's a bug that within pkgsrc, 'cc -pthread' succeeds when
  (the wrapper) is executed during a build of a package that has not
  declared a dependency on pthreads.  Rather than working, the call
  should error out, just as linking a library that is not bl3'd in to
  the package will fail.

Opinions?

Attachment: pgpKmJi4ouXJW.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index