issue with fork

Nikos Mavrogiannopoulos nmav at gnutls.org
Sun Aug 14 05:08:10 PDT 2011


Hey Stef,
 Concerning the issue I had with opensc being unusable with
p11-kit in my system, I think I have identified it. It seems
SCardEstablishContext (from libpcsclite used by opensc) starts
a pcsc server if it is not already running and thus in my system it
executes fork(). This causes an infinite loop of p11-kit trying to
reinitialize the same module over and over.

The problem seems to be in reinitialize_after_fork() which
sets the initialize_count = 0 in all modules and try to reinitialize
them causing the loop. I don't have a quick fix but it seems it
should only include the fully initialized modules, thus allow
a module to include a fork() in its initialization.

regards,
Nikos

btw. The backtrace:

#1  0x00007ffff576ba51 in SCardEstablishContext () from
/lib/libpcsclite.so.1
#2  0x00007ffff59b1365 in pcsc_detect_readers (ctx=0x647550) at
reader-pcsc.c:902
#3  0x00007ffff598a2c8 in sc_ctx_detect_readers (ctx=0x647550) at ctx.c:585
#4  0x00007ffff598b1fb in sc_context_create (ctx_out=<value optimized
out>, parm=<value optimized out>) at ctx.c:696
#5  0x00007ffff6250a07 in C_Initialize (pInitArgs=0x645cc8) at
pkcs11-global.c:225
#6  0x00007ffff68069a7 in initialize_module_unlocked_reentrant
(mod=0x645ca0) at modules.c:461
#7  0x00007ffff6807c00 in p11_kit_load_initialize_module
(module_path=0x7fffffffe2b5 "/usr/lib/pkcs11/opensc-pkcs11.so",
module=0x7fffffffe288) at modules.c:1108
#8  0x00007ffff7b425b0 in gnutls_pkcs11_add_provider
(name=0x7fffffffe2b5 "/usr/lib/pkcs11/opensc-pkcs11.so", params=<value
optimized out>) at pkcs11.c:267
#9  0x00007ffff7b427bf in _pkcs11_compat_init (configfile=<value
optimized out>) at pkcs11.c:470
#10 0x00007ffff7b428fd in gnutls_pkcs11_init (flags=<value optimized
out>, deprecated_config_file=0x0) at pkcs11.c:558
#11 0x00007ffff7b2ff75 in gnutls_global_init () at gnutls_global.c:273


More information about the p11-glue mailing list