Bug 1520990

Summary: [Fedora] openldap does not re-register nss shutdown callbacks after nss_Shutdown is called
Product: [Fedora] Fedora Reporter: Matus Honek <mhonek>
Component: openldapAssignee: Matus Honek <mhonek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: medium    
Version: 26CC: cheimes, mhonek, quanah, rmeggins
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openldap-2.4.45-4.fc27 openldap-2.4.45-2.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1405354 Environment:
Last Closed: 2017-12-12 11:25:50 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:
Bug Depends On: 1071520, 1405354    
Bug Blocks: 1519167    

Description Matus Honek 2017-12-05 15:20:07 UTC
+++ This bug was initially created as a clone of Bug #1405354 +++

Description of problem:
If using a custom SSL context through the LDAP_OPT_X_TLS_NEWCTX LDAP option, openldap will call nss_ShutdownContext on each unbind.  When the last connection is unbound, NSS will call nss_Shutdown to unload the entire NSS library.  Once this happens, if using PEM files, the next unbind will result in SEC_BUSY with the following text:  TLS: could not shutdown NSS - error -8053:NSS could not shutdown. Objects are still in use..

This happens because the tlsm_nss_shutdown_cb is only registered once, and nss_Shutdown will unregister it.  tlsm_nss_shutdown_cb is responsible for unloading the nss PEM module.  Since the shutdown function is no longer called, the PEM module is still loaded, and the NSS module refuses to shut down correctly.  Eventually this causes many other strange issues such as complaints that no slots are available for the certificates that it reads.

Version-Release number of selected component (if applicable):
Any Fedora release prior a fix for this bug.

How reproducible:
Always

Steps to Reproduce:
1. Create a LDAPS connection using a custom context by calling ldap_set_option with LDAP_OPT_X_TLS_NEWCTX.  This also requires manually setting the LDAP_OPT_X_TLS_CACERTDIR or LDAP_OPT_X_TLS_CACERTFILE, LDAP_OPT_X_TLS_CERTFILE, and LDAP_OPT_X_TLS_KEYFILE, as a minimum.
2. Bind to an LDAPS server, then unbind
3. Bind again, then unbind.

Actual results:
TLS: could not shutdown NSS - error -8053:NSS could not shutdown. Objects are still in use..  and other strange behavior

Expected results:
Continued operation in binding and unbinding.

Comment 2 Quanah Gibson-Mount 2017-12-06 15:28:10 UTC
Thanks for tracking it down.  I've added it to the queue for OpenLDAP 2.4.46.

Comment 3 Christian Heimes 2017-12-06 18:40:17 UTC
F26 and F27 builds are both blocked by hanging aarch64 builder:

* https://koji.fedoraproject.org/koji/taskinfo?taskID=23559365
* https://koji.fedoraproject.org/koji/taskinfo?taskID=23559386

Comment 4 Fedora Update System 2017-12-07 08:14:09 UTC
openldap-2.4.45-4.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-3789b9721a

Comment 5 Fedora Update System 2017-12-07 08:14:15 UTC
openldap-2.4.45-2.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-ca4946dac6

Comment 6 Fedora Update System 2017-12-09 07:27:44 UTC
openldap-2.4.45-2.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-ca4946dac6

Comment 7 Fedora Update System 2017-12-10 00:32:00 UTC
openldap-2.4.45-4.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-3789b9721a

Comment 8 Fedora Update System 2017-12-12 11:25:50 UTC
openldap-2.4.45-4.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2017-12-12 13:43:41 UTC
openldap-2.4.45-2.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.