Bug 1502713

Summary: SSSD can crash due to ABI changes in libldb >= 1.2.0 (1.1.30)
Product: Red Hat Enterprise Linux 7 Reporter: Lukas Slebodnik <lslebodn>
Component: sssdAssignee: SSSD Maintainers <sssd-maint>
Status: CLOSED ERRATA QA Contact: Amith <apeetham>
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: grajaiya, jhrozek, lslebodn, mkosek, mpitt, mvollmer, mzidek, pbrezina, sdodson, sgoveas, tscherf
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1506142 (view as bug list) Environment:
Last Closed: 2018-04-10 17:18:11 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:    
Bug Blocks: 1506142    

Description Lukas Slebodnik 2017-10-16 13:50:48 UTC
Description of problem:
There is an incompatible ABI change in libldb-1.1.30[1,2]. SSSD will crash if sssd was compiled with older version and started with newer libldb than 1.1.30.
We need to ensure that such situation will not happen. And the simplest solution is on rpm level. So it will not be allowed to install incompatible packages.
Because some people tend upgrade just subset of packages or just security updates (e.g. BZ#1484423)

Referenced link to libldb rebase bug
https://bugzilla.redhat.com/show_bug.cgi?id=1470056


[1] https://lists.samba.org/archive/samba-technical/2017-June/121233.html
[2] https://bugzilla.samba.org/show_bug.cgi?id=12859

Version-Release number of selected component (if applicable):
All sssd version compiled with libldb <= 1.1.30 (rhel <= 7.4) 

How reproducible:
Deterministic

Steps to Reproduce:
1. systemctl start sssd.service

Actual results:
sh# /usr/sbin/sssd -i
(Mon Oct 16 09:30:07 2017) [sssd] [sysdb_domain_init_internal] (0x0200): DB File for LDAP: /var/lib/sss/db/cache_LDAP.ldb
(Mon Oct 16 09:30:07 2017) [sssd] [sysdb_domain_init_internal] (0x0200): Timestamp file for LDAP: /var/lib/sss/db/timestamps_LDAP.ldb
Segmentation fault (core dumped)

sh# coredumpctl info
           PID: 25224 (sssd)
           UID: 0 (root)
           GID: 0 (root)
        Signal: 11 (SEGV)
     Timestamp: Mon 2017-10-16 09:29:32 EDT (10min ago)
  Command Line: /usr/sbin/sssd -i -f
    Executable: /usr/sbin/sssd
 Control Group: /system.slice/sssd.service
          Unit: sssd.service
         Slice: system.slice
       Boot ID: 27096d033d77453c99f5126d31f46fcb
    Machine ID: 345337a612b343269f70a188e640870c
      Coredump: /var/lib/systemd/coredump/core.sssd.0.27096d033d77453c99f5126d31f46fcb.25224.1508160572000000.xz
       Message: Process 25224 (sssd) of user 0 dumped core.
                
                Stack trace of thread 25224:
                #0  0x00007f1b76112d58 __dso_handle (memberof.so) 


Expected results:
No crash

Additional info:
The similar situation was in fedora26 and fedora26. And it is solved on packaging level.

fedora <= 26:
* has libldb-1.1.29
* conflict in sssd spec file
  https://src.fedoraproject.org/rpms/sssd/blob/f26/f/sssd.spec#_254

fedora >= 27
* has libldb 1.2.2
* sssd requires libldb >= 1.2
  https://src.fedoraproject.org/rpms/sssd/blob/f27/f/sssd.spec#_256

Comment 10 Jakub Hrozek 2017-10-24 09:01:15 UTC
Moving to modified because since commit 1acb4ee7e3395b42ac9d22203c05d13d5f59c524 in rhpkg, we have 1.2.2 as the minimal required version.

Comment 13 Amith 2017-11-28 21:21:59 UTC
Verified this bug on SSSD Version : sssd-1.16.0-6.el7

Steps followed during verification:

1. Setup RHEL-7.5 system and install older version of sssd and libldb and avoid samba package, see the command output below:

# rpm -q sssd samba libldb
sssd-1.15.2-50.el7.x86_64
package samba is not installed
libldb-1.1.29-1.el7.x86_64

2. Clear the cache and ensure sssd service is stopped.

3. Install samba package. This should update libldb and other packages keeping older sssd version intact.

# yum install samba
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
.
.
.
Updating   : samba-common-4.7.1-2.el7.noarch
Updating   :libldb-.2.2-1.el7.x86_64
Updating   : libwbclient-4.7.1-2.el7.x86_64
Updating   : samba-client-libs-4.7.1-2.el7.x86_64
Installing : samba-common-libs-4.7.1-2.el7.x86_64
Installing : pytalloc-2.1.10-1.el7.x86_64
Installing : samba-libs-4.7.1-2.el7.x86_64
Installing : samba-common-tools-4.7.1-2.el7.x86_64
Installing : samba-4.7.1-2.el7.x86_64

# rpm -q sssd samba libldb
sssd-1.15.2-50.el7.x86_64
samba-4.7.1-2.el7.x86_64
libldb-1.2.2-1.el7.x86_64


4. Now start SSSD service, it should show segmentation fault.

# /usr/sbin/sssd -i
Segmentation fault

5. Upgrade sssd to the latest version and restart sssd service. SSSD should work fine now.

# yum upgrade sssd

# rpm -q sssd samba libldb
sssd-1.16.0-6.el7.x86_64
samba-4.7.1-2.el7.x86_64
libldb-1.2.2-1.el7.x86_64

# systemctl start sssd
# systemctl status sssd
● sssd.service - System Security Services Daemon
   Loaded: loaded (/usr/lib/systemd/system/sssd.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2017-11-28 16:05:43 EST; 2s ago
 Main PID: 25512 (sssd)
.
.

6. Run user lookup and ensure SSSD is functioning properly.

# getent passwd testuser1
testuser1:*:2121:2121:testuser1:/home/testuser1:/bin/bash

Comment 18 errata-xmlrpc 2018-04-10 17:18:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0929