diff --git a/SOURCES/0019-libdaemon-CLOEXEC-descriptors-are-not-stray-fds.patch b/SOURCES/0019-libdaemon-CLOEXEC-descriptors-are-not-stray-fds.patch new file mode 100644 index 0000000..364e368 --- /dev/null +++ b/SOURCES/0019-libdaemon-CLOEXEC-descriptors-are-not-stray-fds.patch @@ -0,0 +1,66 @@ +From 15a45c4881edb516fff3d981185b6150ac79ffa0 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Wed, 11 Feb 2026 00:04:54 +0100 +Subject: [PATCH] libdaemon: CLOEXEC descriptors are not stray fds + +Preserve descriptors that have FD_CLOEXEC set - these are +intentionally opened by well-behaved libraries (e.g. PKCS#11 +modules) that properly marked their fds. Close descriptors +without FD_CLOEXEC as these are stray/leaked. + +Resolves the case where s390 opens /dev/z90crypt device within +initialization of library libcrypto and expects this descriptor +remains open. + +Reported-by: loberman@redhat.com +(cherry picked from commit de86ca92d047eb74ebeac9422db2b3a3302d3bc7) +--- + WHATS_NEW | 4 ++++ + libdaemon/server/daemon-stray.h | 12 ++++++++++++ + 2 files changed, 16 insertions(+) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 4afebb594..0402b5679 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,3 +1,7 @@ ++Version 2.03.39 - ++================== ++ Preserve file desciptors with CLOEXEC opened in library constructors. ++ + Version 2.03.37 - + ================== + Warn on classic snapshot on raid creation and error on activation + test. +diff --git a/libdaemon/server/daemon-stray.h b/libdaemon/server/daemon-stray.h +index 87524089a..ded27e22d 100644 +--- a/libdaemon/server/daemon-stray.h ++++ b/libdaemon/server/daemon-stray.h +@@ -77,6 +77,7 @@ static void _daemon_close_descriptor(int fd, unsigned suppress_warnings, + { + char filename[PATH_MAX]; + int r; ++ int flags; + + /* Ignore bad file descriptors */ + if (!is_valid_fd(fd)) +@@ -85,6 +86,17 @@ static void _daemon_close_descriptor(int fd, unsigned suppress_warnings, + if (!suppress_warnings) + _daemon_get_filename(fd, filename, sizeof(filename)); + ++ /* Retrieve FD flags before closing */ ++ flags = fcntl(fd, F_GETFD); ++ ++ /* ++ * Skip descriptors marked close-on-exec. ++ * These are intentionally opened by well-behaved libraries ++ * (e.g. a PKCS#11 module) that properly set FD_CLOEXEC. ++ */ ++ if (flags >= 0 && (flags & FD_CLOEXEC)) ++ return; ++ + r = close(fd); + if ((fd <= STDERR_FILENO) || suppress_warnings) + return; +-- +2.53.0 + diff --git a/SPECS/lvm2.spec b/SPECS/lvm2.spec index b9cba14..8d15def 100644 --- a/SPECS/lvm2.spec +++ b/SPECS/lvm2.spec @@ -41,7 +41,7 @@ %global commit 4a1f6173d29a7d7ecab14a9313000aa5f81170d0 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %endif -%global rel_suffix .1 +%global rel_suffix .2 # Do not reset Release to 1 unless both lvm2 and device-mapper # versions are increased together. @@ -84,6 +84,8 @@ Patch15: 0015-activating-raid-LV-with-partial-snapshot-is-an-error.patch Patch16: 0016-lv_manip-show-a-warning-during-classic-snapshot-crea.patch Patch17: 0017-test-add-new-test-for-snapshot-on-raid-creation-acti.patch Patch18: 0018-WHATS_NEW-update.patch +# RHEL-153392: +Patch19: 0019-libdaemon-CLOEXEC-descriptors-are-not-stray-fds.patch BuildRequires: make BuildRequires: gcc @@ -715,6 +717,9 @@ An extensive functional testsuite for LVM2. %endif %changelog +* Fri Mar 06 2026 Marian Csontos - 2.03.32-2.el9_7.2 +- Fix false positive warnings about stray FDs on s390x. + * Mon Nov 10 2025 Marian Csontos - 2.03.32-2.el9_7.1 - Add message when activating RAID volumes with snapshots.