Bug 1006280 - fails to sustain fork()
fails to sustain fork()
Product: Fedora
Classification: Fedora
Component: nss (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Elio Maldonado Batiz
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-09-10 07:26 EDT by Ales Kozumplik
Modified: 2015-06-29 08:21 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-06-29 08:21:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Ales Kozumplik 2013-09-10 07:26:31 EDT
I've already talked to some people about this via IRC and email. Will reproduce the main parts of the communication with Robert (thanks!) here:

After a fork in the app (anaconda, the fork happens through python's multiprocessing fwiw) calls to nss are failing. first i saw HASH_Create is failing, so asked around and nalin tipped me it could be that we don't call SECMOD_RestartModules() I didn't think we needed that since RPM recreates the entire nss context after a fork but I'm calling RestartModules now instead and the call fails. I put the debugger on it and was able to track the failure down to PK11_InitToken there this line returns NULL:

crv = PK11_GETTAB(slot)->C_GetTokenInfo(slot->slotID,&tokenInfo);

and the debugger won't let me step into that (it somehow has troubles mapping the call address to the implementation). It seems that the error returned is CKR_SLOT_ID_INVALID.

This doesn't happen if we plain fork() a trivial program using librpm (i.e. some crypto has to take place first). After installing nss-softkn-debuginfo I still wasn't able to step into the calls through PK11_GETTAB.

printing *slot from the debugger yields:

$1 = {functionList = 0x7fe8c1e6e7a0, module = 0x2868b40, needTest = 0, isPerm = 1, isHW = 0, isInternal = 1,
  disabled = 0, reason = PK11_DIS_NONE, readOnly = 1, needLogin = 0, hasRandom = 1, defRWSession = 0,
  isThreadSafe = 1, flags = 1539, session = 1, sessionLock = 0x27de4d0, slotID = 1, defaultFlags = 2684616509,
  refCount = 17, freeListLock = 0x27ede40, freeSymKeysWithSessionHead = 0x2e2b260, freeSymKeysHead = 0x2e02880,
  keyCount = 7, maxKeyCount = 800, askpw = 0, timeout = 30, authTransact = 0, authTime = 0, minPassword = 0,
  maxPassword = 0, series = 2, flagSeries = 13107, flagState = 858993459, wrapKey = 0, wrapMechanism = 306, refKeys = {
    10}, mechanismList = 0x28370e0, mechanismCount = 148, cert_array = 0x0, array_size = 858993459, cert_count = 0,
  serial = '0' <repeats 16 times>, slot_name = "NSS Internal Cryptographic Services\000", '\063' <repeats 29 times>,
  token_name = "NSS Generic Crypto Services\000\063\063\063\063\063", hasRootCerts = 0, hasRootTrust = 858993459,
  hasRSAInfo = 1, RSAInfoFlags = 424704, protectedAuthPath = 0, isActiveCard = 0, lastLoginCheck = 0, lastState = 0,
  nssToken = 0x2836720,
  mechanismBits = "\a\a\006\003\003\003\001\000\000\000\000\000\000\001\000\000\a\a\005", '\000' <repeats 13 times>, "\a\a\006\002\002\002\000\000\000\000\000\000\000\000\000\000\002\002\002\002\002\002\002\000\000\000\000\000\000\000\000\000\003\003\003\002\002\002\001\000\000\000\000\000\000\000\000\000ldd``d\004\004\000\000\000\000\000\000\000\000\f\004\f\b\b\b\000\000\000\000\000\000\000\000\000\000\f\f\f\b\000\b\b\b\000\000\000\000\000\000\000\000\b\b", '\000' <repeats 14 times>, "\b\b\b\b\b\b\b\000\000\000\000\000\000\000\000\000\b\b\000\000\000\000\b\b\b\b\b\b\000\000\000\000\b", '\000' <repeats 15 times>, "\b", '\000' <repeats 62 times>} 

If I ignore the failed call to SECMOD_RestartModules() the crypto won't work, HASH_Create(HASH_AlgSHA256) typically fails.

I am opening this bug to keep track. I've already spent well over the time I had to debug this so the Anaconda DNF Payload implementation will proceed by disabling signatures verification/digests in rpm. If this poses a problem in the future either this bug needs to be resolved by the NSS maintainers (if possible---the fork-checking magic in the NSS code is inviting bugs like this) or the DNF Payload will have to do the full dance of spawning a new process, feeding it all the necessary data and letting it do the transaction. This is of course much less elegant and harms the performance of the payload.
Comment 2 Fedora End Of Life 2015-05-29 05:23:01 EDT
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 3 Fedora End Of Life 2015-06-29 08:21:19 EDT
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.