Bug 783431
Summary: | replication (syncrepl) with TLS causes segfault | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jan Vcelak <jvcelak> | ||||||
Component: | openldap | Assignee: | Jan Vcelak <jvcelak> | ||||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
Severity: | high | Docs Contact: | |||||||
Priority: | unspecified | ||||||||
Version: | rawhide | CC: | jsynacek, jvcelak, rmeggins, tsmetana | ||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | openldap-2.4.26-6.fc16 | Doc Type: | Bug Fix | ||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | |||||||||
: | 783445 (view as bug list) | Environment: | |||||||
Last Closed: | 2012-02-17 00:58:01 UTC | Type: | --- | ||||||
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: | |||||||||
Bug Blocks: | 783445 | ||||||||
Attachments: |
|
Description
Jan Vcelak
2012-01-20 11:51:48 UTC
Created attachment 556509 [details] configs and scripts to reproduce Steps to reproduce: (work as a root) 1. decompress in /root (you should get /root/bz783431 dir) 2. append content of /root/bz783431/hosts.add to your /etc/hosts 3. run first server by running "make run" in /root/bz783431/server1 4. run second server by running "make run" in /root/bz783431/server2 the first server will crash in a few moments When the first server is started, it wants to create a new connection to the second server for replication. This is done in "do_syncrep1" by calling "slapd_client_connect". sb_tls_do_init in slapd_bindconf sb* is unset and new TLS context is created. This context is also stored in sb* and used for the next connections. Deferred initialization is used with MozNSS backend. When the second server comes up, the real initialization takes place. At this point, the TLS parameters are taken from the TLS context structure (*tc_config member of struct tlsm_ctx). It seems, that these information are no longer valid and an uninitialized memory is touched, which causes segfault. The TLS parameters are really not available. During tlsm_ctx_new, the pointer to lo->ldo-tls_info is taken: (gdb) p lo->ldo_tls_info $7 = {lt_certfile = 0x7fffe4100d00 "replicator", lt_keyfile = 0x0, lt_dhfile = 0x0, lt_cacertfile = 0x0, lt_cacertdir = 0x7fffe4100ce0 "/root/bz783431/certdb", lt_ciphersuite = 0x0, lt_crlfile = 0x0, lt_randfile = 0x0, lt_protocol_min = 0} (gdb) p &lo->ldo_tls_info $8 = (struct ldaptls *) 0x7fffe41009d8 And when the first connection fails, the structure is freed in ldap_int_tls_destroy. This can be solved by copying the TLS initialization data into the TLS context structure temporarily. And the data can be freed when the deferred initialization is finished. I will write a patch. Created attachment 557415 [details]
proposed patch
Fix: Make a copy of TLS configuration in tlsm_ctx_init and free it later when tlsm_deferred_ctx_init finishes. When the initialization never takes place, the copy is freed in tlsm_ctx_free.
(Patch applies cleanly on 2.4.28 release tarball -- Fedora Rawhide.)
Thank you for the review, Rich. Patch submitted upstream: http://www.openldap.org/its/index.cgi?findid=7136 Fixed in: openldap-2.4.26-6.fc16 openldap-2.4.28-3.fc17 openldap-2.4.26-6.fc16 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/openldap-2.4.26-6.fc16 Package openldap-2.4.26-6.fc16: * should fix your issue, * was pushed to the Fedora 16 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing openldap-2.4.26-6.fc16' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2012-1135/openldap-2.4.26-6.fc16 then log in and leave karma (feedback). openldap-2.4.26-6.fc16 has been pushed to the Fedora 16 stable repository. If problems still persist, please make note of it in this bug report. |