Bug 2356528 - libdnf5-plugin-expired-pgp-keys-5.2.12.0-1.fc43: fapolicyd RPM plugin segfaults in fapolicyd_init() if expired-pgp-keys libdnf5 plugin removes an OpenPGP key
Summary: libdnf5-plugin-expired-pgp-keys-5.2.12.0-1.fc43: fapolicyd RPM plugin segfaul...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf5
Version: 42
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Petr Pisar
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-04-01 09:54 UTC by Mads Kiilerich
Modified: 2025-04-11 18:27 UTC (History)
6 users (show)

Fixed In Version: dnf5-5.2.12.0-2.fc43 dnf5-5.2.12.0-2.fc41 dnf5-5.2.12.0-2.fc42
Clone Of:
Environment:
Last Closed: 2025-04-08 01:28:42 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github rpm-software-management dnf5 pull 2147 0 None Merged expired-pgp-keys: Respect install root 2025-04-02 11:38:31 UTC

Description Mads Kiilerich 2025-04-01 09:54:14 UTC
When updating after system-upgrade to f42, dnf segfaults.

1. 1I don't know why it is removing a PGP key. The lack of information might just be a minor usability issue, but it is making problem solving harder.

2. Also, it seems like dnf somehow is doing something that prevents abrt from reporting the crash. That seems like a bug.

3. No matter what, dnf should never segfault.


root@lone:~# dnf -y update
Updating and loading repositories:
Repositories loaded.
gpg: WARNING: No valid encryption subkey left over.
The following OpenPGP key (0x307EA071) is about to be removed:
 Reason     : Expired on 2023-03-02 03:42:01
 UserID     : "Rapture Automatic Signing Key (cloud-rapture-signing-key-2021-03-01-08_01_09.pub)"
 Fingerprint: 7F92E05B31093BEF5A3C2D38FEEA9169307EA071

As a result, installing packages signed with this key will fail.
It is recommended to remove the expired key to allow importing
an updated key. This might leave already installed packages unverifiable.

The system will now proceed with removing the key.
Segmentation fault (core dumped)

journal:
Apr 01 11:43:48 lone audit[116654]: ANOM_ABEND auid=1000 uid=0 gid=0 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=116654 comm="dnf" exe="/usr/bin/dnf5" sig=11 res=1
Apr 01 11:43:48 lone kernel: dnf[116654]: segfault at 0 ip 00007fc7556599f0 sp 00007fff55609cc0 error 4 in fapolicyd.so[9f0,7fc755659000+1000] likely on CPU 17 (core 37, socket 0)
Apr 01 11:43:48 lone kernel: Code: 89 f7 48 89 e5 53 48 89 f3 48 83 ec 08 e8 a8 fa ff ff a8 03 74 0c 48 8b 5d f8 31 c0 c9 c3 0f 1f 40 00 48 89 df e8 10 fb ff ff <80> 38 2f 75 e7 80 78 01 00 75 e1 e8 40 fc ff ff 48 8b 5d f8 31 c0
Apr 01 11:43:48 lone systemd-coredump[116668]: Process 116654 (dnf) of user 0 terminated abnormally with signal 11/SEGV, processing...
Apr 01 11:43:48 lone audit: BPF prog-id=133 op=LOAD
Apr 01 11:43:48 lone audit: BPF prog-id=134 op=LOAD
Apr 01 11:43:48 lone audit: BPF prog-id=135 op=LOAD
Apr 01 11:43:48 lone systemd[1]: Started systemd-coredump - Process Core Dump (PID 116668/UID 0).
Apr 01 11:43:48 lone audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-coredump@5-116668-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Apr 01 11:43:48 lone abrt-dump-journal-core[1318]: Failed to obtain all required information from journald
Apr 01 11:43:49 lone systemd-coredump[116669]: Process 116654 (dnf) of user 0 dumped core.

                                               Module /usr/bin/dnf5 from rpm dnf5-5.2.12.0-1.fc42.x86_64
                                               Module fapolicyd.so from rpm rpm-4.20.1-1.fc42.x86_64
                                               Module libdbus-1.so.3 from rpm dbus-1.16.0-3.fc42.x86_64
                                               Module dbus_announce.so from rpm rpm-4.20.1-1.fc42.x86_64
                                               Module libcap-ng.so.0 from rpm libcap-ng-0.8.5-4.fc42.x86_64
                                               Module libaudit.so.1 from rpm audit-4.0.3-2.fc42.x86_64
                                               Module audit.so from rpm rpm-4.20.1-1.fc42.x86_64
                                               Module libplain.so from rpm cyrus-sasl-2.1.28-30.fc42.x86_64
                                               Module liblogin.so from rpm cyrus-sasl-2.1.28-30.fc42.x86_64
                                               Module libgssapiv2.so from rpm cyrus-sasl-2.1.28-30.fc42.x86_64
                                               Module libsasldb.so from rpm cyrus-sasl-2.1.28-30.fc42.x86_64
                                               Module libanonymous.so from rpm cyrus-sasl-2.1.28-30.fc42.x86_64
                                               Module libnss_myhostname.so.2 from rpm systemd-257.3-7.fc42.x86_64
                                               Module expired-pgp-keys.so from rpm dnf5-5.2.12.0-1.fc42.x86_64
                                               Module reposync_cmd_plugin.so from rpm dnf5-5.2.12.0-1.fc42.x86_64
                                               Module repoclosure_cmd_plugin.so from rpm dnf5-5.2.12.0-1.fc42.x86_64
                                               Module needs_restarting_cmd_plugin.so from rpm dnf5-5.2.12.0-1.fc42.x86_64
                                               Module copr_cmd_plugin.so from rpm dnf5-5.2.12.0-1.fc42.x86_64
                                               Module config-manager_cmd_plugin.so from rpm dnf5-5.2.12.0-1.fc42.x86_64
                                               Module changelog_cmd_plugin.so from rpm dnf5-5.2.12.0-1.fc42.x86_64
                                               Module libelf.so.1 from rpm elfutils-0.192-9.fc42.x86_64
                                               Module libdw.so.1 from rpm elfutils-0.192-9.fc42.x86_64
                                               Module libmagic.so.1 from rpm file-5.46-1.fc42.x86_64
                                               Module librpmbuild.so.10 from rpm rpm-4.20.1-1.fc42.x86_64
                                               Module builddep_cmd_plugin.so from rpm dnf5-5.2.12.0-1.fc42.x86_64
                                               Module libcrypt.so.2 from rpm libxcrypt-4.4.38-6.fc42.x86_64
                                               Module libblkid.so.1 from rpm util-linux-2.40.4-7.fc42.x86_64
                                               Module libbrotlicommon.so.1 from rpm brotli-1.1.0-6.fc42.x86_64
                                               Module libsasl2.so.3 from rpm cyrus-sasl-2.1.28-30.fc42.x86_64
                                               Module libevent-2.1.so.7 from rpm libevent-2.1.12-15.fc42.x86_64
                                               Module libkeyutils.so.1 from rpm keyutils-1.6.3-5.fc42.x86_64
                                               Module libkrb5support.so.0 from rpm krb5-1.21.3-5.fc42.x86_64
                                               Module libcom_err.so.2 from rpm e2fsprogs-1.47.2-3.fc42.x86_64
                                               Module libk5crypto.so.3 from rpm krb5-1.21.3-5.fc42.x86_64
                                               Module libkrb5.so.3 from rpm krb5-1.21.3-5.fc42.x86_64
                                               Module libunistring.so.5 from rpm libunistring-1.1-9.fc42.x86_64
                                               Module libselinux.so.1 from rpm libselinux-3.8-1.fc42.x86_64
                                               Module libmount.so.1 from rpm util-linux-2.40.4-7.fc42.x86_64
                                               Module libgmodule-2.0.so.0 from rpm glib2-2.84.0-1.fc42.x86_64
                                               Module libbrotlidec.so.1 from rpm brotli-1.1.0-6.fc42.x86_64
                                               Module libgssapi_krb5.so.2 from rpm krb5-1.21.3-5.fc42.x86_64
                                               Module libpsl.so.5 from rpm libpsl-0.21.5-5.fc42.x86_64
                                               Module libssh.so.4 from rpm libssh-0.11.1-4.fc42.x86_64
                                               Module libidn2.so.0 from rpm libidn2-2.3.8-1.fc42.x86_64
                                               Module libnghttp2.so.14 from rpm nghttp2-1.64.0-3.fc42.x86_64
                                               Module libssl.so.3 from rpm openssl-3.2.4-3.fc42.x86_64
                                               Module libgio-2.0.so.0 from rpm glib2-2.84.0-1.fc42.x86_64
                                               Module libcrypto.so.3 from rpm openssl-3.2.4-3.fc42.x86_64
                                               Module libcurl.so.4 from rpm curl-8.11.1-4.fc42.x86_64
                                               Module libzck.so.1 from rpm zchunk-1.5.1-2.fc42.x86_64
                                               Module libpcre2-8.so.0 from rpm pcre2-10.45-1.fc42.x86_64
                                               Module libffi.so.8 from rpm libffi-3.4.6-5.fc42.x86_64
                                               Module libyaml-0.so.2 from rpm libyaml-0.2.5-16.fc42.x86_64
                                               Module libattr.so.1 from rpm attr-2.5.2-5.fc42.x86_64
                                               Module liblzma.so.5 from rpm xz-5.6.3-3.fc42.x86_64
                                               Module libzstd.so.1 from rpm zstd-1.5.7-1.fc42.x86_64
                                               Module librpm_sequoia.so.1 from rpm rust-rpm-sequoia-1.7.0-5.fc42.x86_64
                                               Module libbz2.so.1 from rpm bzip2-1.0.8-20.fc42.x86_64
                                               Module libz.so.1 from rpm zlib-ng-2.2.4-3.fc42.x86_64
                                               Module librepo.so.0 from rpm librepo-1.19.0-3.fc42.x86_64
                                               Module libxml2.so.2 from rpm libxml2-2.12.10-1.fc42.x86_64
                                               Module libsolvext.so.1 from rpm libsolv-0.7.31-5.fc42.x86_64
                                               Module libsolv.so.1 from rpm libsolv-0.7.31-5.fc42.x86_64
                                               Module libglib-2.0.so.0 from rpm glib2-2.84.0-1.fc42.x86_64
                                               Module libgobject-2.0.so.0 from rpm glib2-2.84.0-1.fc42.x86_64
                                               Module libmodulemd.so.2 from rpm libmodulemd-2.15.0-16.fc42.x86_64
                                               Module liblua-5.4.so from rpm lua-5.4.7-3.fc42.x86_64
                                               Module libpopt.so.0 from rpm popt-1.19-8.fc42.x86_64
                                               Module libcap.so.2 from rpm libcap-2.73-2.fc42.x86_64
                                               Module libacl.so.1 from rpm acl-2.3.2-3.fc42.x86_64
                                               Module librpmio.so.10 from rpm rpm-4.20.1-1.fc42.x86_64
                                               Module libjson-c.so.5 from rpm json-c-0.18-2.fc42.x86_64
                                               Module libsmartcols.so.1 from rpm util-linux-2.40.4-7.fc42.x86_64
                                               Module libfmt.so.11 from rpm fmt-11.1.4-1.fc42.x86_64
                                               Module libdnf5.so.2 from rpm dnf5-5.2.12.0-1.fc42.x86_64
                                               Module libsystemd.so.0 from rpm systemd-257.3-7.fc42.x86_64
                                               Module libsdbus-c++.so.1 from rpm sdbus-cpp-1.5.0-4.fc42.x86_64
                                               Module librpm.so.10 from rpm rpm-4.20.1-1.fc42.x86_64
                                               Module libdnf5-cli.so.2 from rpm dnf5-5.2.12.0-1.fc42.x86_64
                                               Stack trace of thread 116654:
                                               #0  0x00007fc7556599f0 fapolicyd_init (fapolicyd.so + 0x9f0)
                                               #1  0x00007fc766482141 rpmtsSetupTransactionPlugins (librpm.so.10 + 0x45141)
                                               #2  0x00007fc766454aa6 rpmtsAddEraseElement (librpm.so.10 + 0x17aa6)
                                               #3  0x00007fc755ec56c0 _ZNK12_GLOBAL__N_114ExpiredPgpKeys24process_expired_pgp_keysERKN7libdnf54base11TransactionE (expired-pgp-keys.so + 0x56c0)
                                               #4  0x00007fc765ea7971 _ZN7libdnf54Goal7resolveEv (libdnf5.so.2 + 0xa7971)
                                               #5  0x000056524f76425a main (/usr/bin/dnf5 + 0x3525a)
                                               #6  0x00007fc7658105f5 __libc_start_call_main (libc.so.6 + 0x35f5)
                                               #7  0x00007fc7658106a8 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x36a8)
                                               #8  0x000056524f7677c5 _start (/usr/bin/dnf5 + 0x387c5)
                                               ELF object binary architecture: AMD x86-64
Apr 01 11:43:49 lone systemd[1]: systemd-coredump: Deactivated successfully.
Apr 01 11:43:49 lone audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-coredump@5-116668-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Apr 01 11:43:49 lone systemd[1]: systemd-coredump: Consumed 533ms CPU time, 216.2M memory peak.
Apr 01 11:43:49 lone audit: BPF prog-id=135 op=UNLOAD
Apr 01 11:43:49 lone audit: BPF prog-id=134 op=UNLOAD
Apr 01 11:43:49 lone audit: BPF prog-id=133 op=UNLOAD
Apr 01 11:43:50 lone abrt-server[116694]: Deleting problem directory ccpp-2025-04-01-11:43:49.445798-116654 (dup of ccpp-2025-04-01-11:41:06.195089-116157)
Apr 01 11:43:50 lone abrt-notification[116740]: Process 116157 (dnf5) crashed in fapolicyd_init()

root@lone:~# rpm -qf /usr/lib64/libdnf5.so.2 /usr/lib64/librpm.so.10.2.1 /usr/lib64/rpm-plugins/fapolicyd.so
libdnf5-5.2.12.0-1.fc42.x86_64
rpm-libs-4.20.1-1.fc42.x86_64
rpm-plugin-fapolicyd-4.20.1-1.fc42.x86_64


Reproducible: Always

Comment 1 Mads Kiilerich 2025-04-01 10:05:31 UTC
Removing rpm-plugin-fapolicyd-4.20.1-1.fc42.x86_64 made it crash in a similar way in dbus_announce.so dbus_announce_tsm_pre instead.

Removing rpm-plugin-dbus-announce-4.20.1-1.fc42.x86_64 made it crash in syslog.so syslog_tsm_pre instead.

Removing rpm-plugin-syslog-4.20.1-1.fc42.x86_64 made the update work, outputting:

...
The system will now proceed with removing the key.
Key 0x307EA071 was successfully removed.
Key 0x836F4BEB was successfully removed.
Key 0x133BBFCF was successfully removed.
...

Perhaps these 3 rpm plugins are broken in f42? The plugins are evidently optional, but if they are packaged for f42 ... and if they are known to be broken, they should have been uninstalled when upgrading. But perhaps more likely, there is a general bug that prevents them from working?

Comment 2 Petr Pisar 2025-04-01 11:42:14 UTC
Thanks for the report. I confirm this issue with dnf5-5.2.12.0-1.fc43.x86_64 if the tree RPM plugins are installed.

Comment 3 Petr Pisar 2025-04-01 11:48:11 UTC
(In reply to Mads Kiilerich from comment #0)
> When updating after system-upgrade to f42, dnf segfaults.
> 
> 1. 1I don't know why it is removing a PGP key. The lack of information might
> just be a minor usability issue, but it is making problem solving harder.
>
[..] 
> root@lone:~# dnf -y update
> Updating and loading repositories:
> Repositories loaded.
> gpg: WARNING: No valid encryption subkey left over.
> The following OpenPGP key (0x307EA071) is about to be removed:
>  Reason     : Expired on 2023-03-02 03:42:01
>
> As a result, installing packages signed with this key will fail.
> It is recommended to remove the expired key to allow importing
> an updated key. This might leave already installed packages unverifiable.

The key is being removed because they key has expired a month ago. Expired keys prevents from updating themselves in the RPM key store in case the repository maintainer would update the key.

Comment 4 Mads Kiilerich 2025-04-01 12:03:16 UTC
(In reply to Petr Pisar from comment #3)
> >  Reason     : Expired on 2023-03-02 03:42:01

Doh. Sorry I didn't pay attention to that. That helps focusing this report.

But also, I ran "yum update" two days ago where it didn't expire the key. The expiry seems to depend on something?

Comment 5 Petr Pisar 2025-04-01 12:16:28 UTC
The remove happens only when a package is being installed/updated/reinstalled. Maybe you did not have anything to update.
Or maybe you had older dnf5 two days ago. DNF5 before 5.2.12.0 had a flaw and actually did not remove any keys.
Or maybe you had not installed gnupg2 at that time. The code actually uses it to get en expiration time of the key as RPM does not provide that information. The DNF code does nothing it there is no gpg program.

Comment 6 Petr Pisar 2025-04-02 11:38:32 UTC
In case of rpm-plugin-fapolicyd the crash happens here:

Thread 1 "dnf5" received signal SIGSEGV, Segmentation fault.
fapolicyd_init (plugin=<optimized out>, ts=0x555555c977e0)
    at /usr/src/debug/rpm-4.20.1-3.fc43.x86_64/plugins/fapolicyd.c:154
154         if (!rstreq(rpmtsRootDir(ts), "/"))

The trigger is that expired-pgp-keys libdnf plugin does not set RPM database root directory. DNF5 corrected that upstream and I will backport the fix.

Comment 7 Petr Pisar 2025-04-02 12:00:15 UTC
The other two plugins are the same case. RPM documentation states an application should set the root directory before calling rpmtsRun(). The RPM plugins take the root directory granted.

Comment 8 Petr Pisar 2025-04-02 12:44:47 UTC
A workaround is disabling expired-pgp-keys plugin with "--disable-plugin expired-pgp-keys" dnf5 option.

Comment 9 Fedora Update System 2025-04-02 14:11:01 UTC
FEDORA-2025-ef5e387d5d (dnf5-5.2.12.0-2.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-ef5e387d5d

Comment 10 Fedora Update System 2025-04-02 14:11:11 UTC
FEDORA-2025-7f78913002 (dnf5-5.2.12.0-2.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-7f78913002

Comment 11 Mads Kiilerich 2025-04-02 14:27:19 UTC
Thanks for fixing.

Any thoughts on why abrt didn't pick it up and report it? Did you see the same when reproducing, or is it something in my local setup?

Comment 12 Petr Pisar 2025-04-02 14:46:21 UTC
I don't have installed ABRT. In the past, before systemd, it was registered in /proc/sys/kernel/core_pattern. Now there is systemd-coredump. I have no idea whether ABRT was ported to systemd. Maybe you hit some limit for a size of the coredump (DNF uses non-trivial amount of memory when resolving dependencies).

Comment 13 Fedora Update System 2025-04-03 02:20:46 UTC
FEDORA-2025-7f78913002 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-7f78913002`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-7f78913002

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2025-04-03 03:43:36 UTC
FEDORA-2025-ef5e387d5d has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-ef5e387d5d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-ef5e387d5d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Fedora Update System 2025-04-08 01:28:42 UTC
FEDORA-2025-7f78913002 (dnf5-5.2.12.0-2.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 16 Fedora Update System 2025-04-11 18:27:28 UTC
FEDORA-2025-ef5e387d5d (dnf5-5.2.12.0-2.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.


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