Bug 1820123

Summary: Memory leak when slapi-nis return entries retrieved from nsswitch
Product: Red Hat Enterprise Linux 7 Reporter: Petr Čech <pcech>
Component: slapi-nisAssignee: Alexander Bokovoy <abokovoy>
Status: CLOSED ERRATA QA Contact: ipa-qe <ipa-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.8CC: abokovoy, afarley, ipa-qe, ksiddiqu, msauton, myusuf, pcech, tbordaz, tmihinto, vashirov
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: slapi-nis-0.56.5 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1750893 Environment:
Last Closed: 2020-09-29 20:33:44 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: 1750893    
Bug Blocks:    
Attachments:
Description Flags
valgrind.xml none

Comment 8 Mohammad Rizwan 2020-06-02 14:56:26 UTC
Created attachment 1694486 [details]
valgrind.xml

version:
ipa-server-4.6.8-3.el7.x86_64
slapi-nis-0.56.5-2.el7.x86_64

[root@master ~]# cat /etc/nsswitch.conf
[..]
passwd:     files sss
shadow:     files sss
group:      files sss
[..]

[root@master ~]# ldapsearch -D "cn=directory manager" -W -b "cn=users,cn=Schema Compatibility,cn=plugins,cn=config" | grep nss
Enter LDAP Password: 
schema-compat-lookup-nsswitch: user

[root@master ~]# ldapsearch -D "cn=directory manager" -W -b "cn=groups,cn=Schema Compatibility,cn=plugins,cn=config" | grep nss
Enter LDAP Password: 
schema-compat-lookup-nsswitch: group

[root@master ~]# valgrind --leak-check=yes --xml=yes  --xml-file=valgrind.xml ipa user-show admin
  User login: admin
  Last name: Administrator
  Home directory: /home/admin
  Login shell: /bin/bash
  Principal alias: admin
  UID: 1738800000
  GID: 1738800000
  Account disabled: False
  Password: True
  Member of groups: admins, trust admins
  Kerberos keys available: True

Comment 9 Mohammad Rizwan 2020-06-02 15:00:24 UTC
Hello Thierry,

Could you confirm if above steps are sufficient to mark the bug as verified? Reported leak pattern didn't observed.

Comment 10 thierry bordaz 2020-06-02 15:24:05 UTC
Hi Mohammad,

The valgrind command will catch the leaks signature [1] . It needs to be used with the DS server [2] instead of the ipa user-show command.
The trigger of the leak is possibly 'ipa user-show' but I am not sure of that. It needs to be tested on a DS instance where the leak is not fixed.

[1] https://bugzilla.redhat.com/attachment.cgi?id=1614009
[2] http://www.port389.org/docs/389ds/FAQ/faq.html#debugging-memory-growthinvalid-access-with-valgrind

Comment 15 Mohammad Rizwan 2020-06-08 15:16:22 UTC
Reproducer:
~~~~~~~~~~~
version:
slapi-nis-0.56.0-13.el7.x86_64

[root@master ~]# grep backend_search_nsswitch /var/run/dirsrv/ns-slapd-TESTRELM-TEST.asan.17822 
    #1 0x7f1634b61009 in backend_search_nsswitch back-sch-nss.c:718


Fix:
~~~~
version:
slapi-nis-0.56.5-2.el7.x86_64

[root@master ~]# grep backend_search_nsswitch /var/run/dirsrv/ns-slapd-TESTRELM-TEST.asan.754  -c
0

Using ASAN from https://bugzilla.redhat.com/show_bug.cgi?id=1820123#c14, leaks didn't observe on fixed version. Hence marking the bug as verified.

Comment 17 errata-xmlrpc 2020-09-29 20:33:44 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 (slapi-nis bug fix and enhancement update), 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/RHBA-2020:4010