Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1714652

Summary: Valgrind reports errors and lost memory when running rpm -Uvh
Product: Red Hat Enterprise Linux 8 Reporter: Jan Pazdziora (Red Hat) <jpazdziora>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 8.0CC: dmach, pmatilai, pmoravco
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-18 07:12:58 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 Jan Pazdziora (Red Hat) 2019-05-28 14:09:05 UTC
Description of problem:

In bug 1702283, I was pointed to rpm as potential culprit of some memory leak issues. So I run rpm -Uvh under valgrind and found issues and memory lost.

Version-Release number of selected component (if applicable):

rpm-4.14.2-17.el8.x86_64

How reproducible:

Deterministic.

Steps to Reproduce:
1. Remove rpm-plugin-systemd-inhibit (we will report that separately):
   rpm -e rpm-plugin-systemd-inhibit
2. Get zsh rpm to play with:
   dnf install --downloadonly zsh
3. Install the rpm:
   valgrind --leak-check=full rpm -Uvh $( find /var/cache/dnf -name 'zsh-*.rpm' )

Actual results:

==27456== Memcheck, a memory error detector
==27456== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==27456== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==27456== Command: rpm -Uvh /var/cache/dnf/beaker-BaseOS-8c497e5ab46f90a9/packages/zsh-5.5.1-6.el8.x86_64.rpm
==27456== 
warning: /var/cache/dnf/beaker-BaseOS-8c497e5ab46f90a9/packages/zsh-5.5.1-6.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:zsh-5.5.1-6.el8                  ################################# [100%]
==27456== Syscall param pwrite64(buf) points to uninitialised byte(s)
==27456==    at 0x740E528: pwrite (in /usr/lib64/libpthread-2.28.so)
==27456==    by 0x585DC14: __os_io (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x5849432: ??? (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x58497CB: __memp_bhwrite (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x5859936: __memp_sync_int (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x57EFFEE: __db_sync (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x5801937: __db_sync_pp (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x4E56EFD: ??? (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E633E9: ??? (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E76BBD: ??? (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E8BB49: ??? (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E92613: rpmtsRun (in /usr/lib64/librpm.so.8.1.0)
==27456==  Address 0xa27ffa3 is 1,139 bytes inside a block of size 4,096 alloc'd
==27456==    at 0x4C30EDB: malloc (vg_replace_malloc.c:309)
==27456==    by 0x585ADF4: __os_malloc (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x58495EF: ??? (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x58497CB: __memp_bhwrite (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x5859936: __memp_sync_int (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x57EFFEE: __db_sync (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x5801937: __db_sync_pp (in /usr/lib64/libdb-5.3.so)
==27456==    by 0x4E56EFD: ??? (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E633E9: ??? (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E76BBD: ??? (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E8BB49: ??? (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E92613: rpmtsRun (in /usr/lib64/librpm.so.8.1.0)
==27456== 
==27456== 
==27456== HEAP SUMMARY:
==27456==     in use at exit: 3,842 bytes in 43 blocks
==27456==   total heap usage: 116,090 allocs, 116,047 frees, 83,186,616 bytes allocated
==27456== 
==27456== 52 bytes in 1 blocks are definitely lost in loss record 10 of 26
==27456==    at 0x4C30EDB: malloc (vg_replace_malloc.c:309)
==27456==    by 0x50CFEAB: rmalloc (in /usr/lib64/librpmio.so.8.1.0)
==27456==    by 0x50D34EA: rasprintf (in /usr/lib64/librpmio.so.8.1.0)
==27456==    by 0x4E9951B: rpmsinfoMsg (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E8F0C7: ??? (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E99AAB: rpmvsVerify (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E92474: rpmtsRun (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E8594F: ??? (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E86B30: rpmInstall (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x109DD9: ??? (in /usr/bin/rpm)
==27456==    by 0x763F812: (below main) (in /usr/lib64/libc-2.28.so)
==27456== 
==27456== 3,499 (48 direct, 3,451 indirect) bytes in 1 blocks are definitely lost in loss record 26 of 26
==27456==    at 0x4C331EA: calloc (vg_replace_malloc.c:762)
==27456==    by 0x50CFEF2: rcalloc (in /usr/lib64/librpmio.so.8.1.0)
==27456==    by 0x4E99664: rpmvsCreate (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E923D0: rpmtsRun (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E8594F: ??? (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x4E86B30: rpmInstall (in /usr/lib64/librpm.so.8.1.0)
==27456==    by 0x109DD9: ??? (in /usr/bin/rpm)
==27456==    by 0x763F812: (below main) (in /usr/lib64/libc-2.28.so)
==27456== 
==27456== LEAK SUMMARY:
==27456==    definitely lost: 100 bytes in 2 blocks
==27456==    indirectly lost: 3,451 bytes in 38 blocks
==27456==      possibly lost: 0 bytes in 0 blocks
==27456==    still reachable: 291 bytes in 3 blocks
==27456==         suppressed: 0 bytes in 0 blocks
==27456== Reachable blocks (those to which a pointer was found) are not shown.
==27456== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==27456== 
==27456== Use --track-origins=yes to see where uninitialised values come from
==27456== For lists of detected and suppressed errors, rerun with: -s
==27456== ERROR SUMMARY: 14 errors from 3 contexts (suppressed: 0 from 0)

Expected results:

No issues and no "definitely lost" and no "indirectly lost" blocks reported.

Additional info:

Comment 1 Panu Matilainen 2019-06-04 10:30:10 UTC
devel_ack+, ixed upstream in https://github.com/rpm-software-management/rpm/pull/718

Comment 2 Panu Matilainen 2019-06-18 07:12:58 UTC
Closing as duplicate of bug 1714657 which covers this plus some other leaks, we'll want to fix them all.

*** This bug has been marked as a duplicate of bug 1714657 ***