Bug 1006287

Summary: digest_nss.c should call SECMOD_RestartModules() on fork()
Product: [Fedora] Fedora Reporter: Ales Kozumplik <akozumpl>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: ffesti, jzeleny, novyjindrich, packaging-team-maint, pmatilai, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-29 12:21:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ales Kozumplik 2013-09-10 11:46:02 UTC
Description of problem:
Apparently, this is what NSS requires to survive a fork() now, e.g. bug 800304.

Also related bug 1006280 shows a case where even calling SECMOD_RestartModules() doesn't help NSS to function properly afterwards.

Comment 1 Panu Matilainen 2013-10-07 09:27:12 UTC
From https://bugzilla.redhat.com/show_bug.cgi?id=800304#c20:
> or if you do:
> 
> NSS_Initialize()
> .
> .
> .
> .
> NSS_Shutdown()
> 
> fork();
> 
> NSS_Initialize()
> .
> .
> .
>
> agin, you don't need to do a restartmodule.

...which is basically what rpm does, this was introduced precisely to allow things to work after a fork(): http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=2ce7b56e621b097b76a2e5059def7d0e5a64d53b

So there shouldn't be any need to additionally call SECMOD_RestartModules(). However both methods of reinitializing only allow *new* handles to work, so whether rpm/nss breaks after a fork() or not might well depend on where and when exactly the fork() occurs. We'd probably need some more debuggable reproducer than anaconda to track down what's going on :-/

However both what

Comment 2 Ales Kozumplik 2013-10-07 09:46:14 UTC
(In reply to Panu Matilainen from comment #1)
> However both methods of reinitializing only allow *new* handles to work, so
> whether rpm/nss breaks after a fork() or not might well depend on where and
> when exactly the fork() occurs. 

handles you mean e.g. HASHContext() objects?

The app is forked right before dnf's do_transaction(). So creating the transaction, ordering, test run and the actual run all happen after the fork. Of course, some rpm calls probably take place before that, but I don't see how the context is reused.

If you believe the nss reinit in RPM is correct I'm not against closing this. It just looked like the preferred way was doing RestartModules().

Comment 3 Panu Matilainen 2013-10-07 12:24:44 UTC
(In reply to Ales Kozumplik from comment #2)
> (In reply to Panu Matilainen from comment #1)
> > However both methods of reinitializing only allow *new* handles to work, so
> > whether rpm/nss breaks after a fork() or not might well depend on where and
> > when exactly the fork() occurs. 
> 
> handles you mean e.g. HASHContext() objects?

Those, key objects etc, although I'm nowhere near sure what all gets broken by a fork().

> The app is forked right before dnf's do_transaction(). So creating the
> transaction, ordering, test run and the actual run all happen after the
> fork. Of course, some rpm calls probably take place before that, but I don't
> see how the context is reused.

Not sure either, but given the "yum legacy" in dnf (transaction wrappers etc) the transaction, associated keyring and such objects might live longer than is obvious. Or something...

> If you believe the nss reinit in RPM is correct I'm not against closing
> this. It just looked like the preferred way was doing RestartModules().

SECMOD_RestartModules() is supposed to be, and likely is, a better way of reinitializing than what rpm is doing, but AIUI what rpm does is supposed to work just as well. As SECMOD_RestartModules() is a fairly new addition to NSS, I'm not keen to make it a required function and at that point using the simpler option actually means adding even more fluff to rpm codebase for handling the same thing it already does (at least supposedly).

Basically I'd like some kind of confirmation that calling SECMOD_RestartModules() actually fixes something. Otherwise adding another way of reinitializing seems kinda pointless...

Comment 5 Fedora End Of Life 2015-05-29 09:23:04 UTC
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 6 Fedora End Of Life 2015-06-29 12:21:23 UTC
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
bug.

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