Bug 2362996 - rpmKeyringVerifySig2 attempts to lock mutex of NULL keyring
Summary: rpmKeyringVerifySig2 attempts to lock mutex of NULL keyring
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-04-29 20:39 UTC by Aaron Merey
Modified: 2025-05-12 08:59 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-05-12 08:59:13 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
backtrace.txt (17.92 KB, text/plain)
2025-04-29 20:40 UTC, Aaron Merey
no flags Details

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


Note You need to log in before you can comment on or make changes to this bug.