Bug 2362996

Summary: rpmKeyringVerifySig2 attempts to lock mutex of NULL keyring
Product: [Fedora] Fedora Reporter: Aaron Merey <amerey>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: igor.raits, mdomonko, packaging-team-maint, pmatilai
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-05-12 08:59:13 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:
Attachments:
Description Flags
backtrace.txt none

Description Aaron Merey 2025-04-29 20:39:14 UTC
Debuginfod server calls rpmReadPackageFile in order to verify IMA signatures.  On Fedora 43 with rpm-5.99.90-4.fc43.x86_64 this results in a segfault due to rpmKeyringVerifySig2 attempting to lock a mutex from NULL keyring.

With rpm-4.20.1-3.fc43.x86_64.rpm installed, files are successfully verified and no segfaults occur.

I've attached a backtrace of the crash.

Reproducible: Always

Steps to Reproduce:
I built elfutils on rawhide with debuginfod and ima verification enabled. I ran the testsuite and the tests in run-debuginfod-ima-verification.sh fail due to the rpmKeyringVerifySig2 segfault. Please let me know if you'd like a more detailed reproducer and I'll describe how to build elfutils and run the tests.

Comment 1 Aaron Merey 2025-04-29 20:40:04 UTC
Created attachment 2087780 [details]
backtrace.txt

Comment 2 Panu Matilainen 2025-04-30 07:03:54 UTC
Hey, thanks for reporting! This has sufficient info for fixing, the missing NULL check is rather obvious in the code. I'll look into it.

Comment 3 Panu Matilainen 2025-04-30 07:43:31 UTC
> Debuginfod server calls rpmReadPackageFile in order to verify IMA signatures.

Note that rpmReadPackageFile() does NOT verify IMA signatures. Rpm itself never does. IMA verification only happens during an actual installation, if the IMA plugin is present and enabled.

Comment 4 Panu Matilainen 2025-04-30 08:54:21 UTC
Ignore the above note, re-reading more carefully debuginfod is reading the header *in order to* verify the IMA signatures (by itself).

Upstream fix now at https://github.com/rpm-software-management/rpm/pull/3741

Comment 5 Panu Matilainen 2025-05-12 08:59:13 UTC
Fixed in rpm >= 5.99.90-5 now