diff --git a/SOURCES/0059-cov-fix-leaking-fd.patch b/SOURCES/0059-cov-fix-leaking-fd.patch new file mode 100644 index 0000000..f315469 --- /dev/null +++ b/SOURCES/0059-cov-fix-leaking-fd.patch @@ -0,0 +1,39 @@ +From 1036f297b0daaa257735f84873b6f4a5762c326e Mon Sep 17 00:00:00 2001 +From: Marian Csontos +Date: Fri, 27 Feb 2026 11:25:45 +0100 +Subject: [PATCH 59/64] cov: fix leaking fd + +--- + lib/device/filesystem.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/lib/device/filesystem.c b/lib/device/filesystem.c +index f1add62f9..adb8f0174 100644 +--- a/lib/device/filesystem.c ++++ b/lib/device/filesystem.c +@@ -215,9 +215,11 @@ static int _btrfs_get_mnt(struct fs_info *fsi, dev_t lv_devt) + r = read(fd, buffer, sizeof(buffer)); + if (r < 0) { + ret = 0; +- close(fd); + log_sys_debug("read", rdev_path); ++ close(fd); + break; ++ } else { ++ close(fd); + } + + buffer[r - 1] = 0; +@@ -239,9 +241,6 @@ static int _btrfs_get_mnt(struct fs_info *fsi, dev_t lv_devt) + break; + } + +- if (fd >= 0) +- close(fd); +- + if (closedir(dr)) + log_sys_debug("closedir", devices_path); + +-- +2.53.0 + diff --git a/SOURCES/0060-lvmlockd-sanlock-fix-uninitialized-time-value.patch b/SOURCES/0060-lvmlockd-sanlock-fix-uninitialized-time-value.patch new file mode 100644 index 0000000..fb69034 --- /dev/null +++ b/SOURCES/0060-lvmlockd-sanlock-fix-uninitialized-time-value.patch @@ -0,0 +1,26 @@ +From 284f3d3b192238129ce451df322d58d82711766d Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Tue, 1 Jul 2025 10:25:48 -0500 +Subject: [PATCH 60/64] lvmlockd-sanlock: fix uninitialized time value + +(cherry picked from commit 1eaada302b3e78b3e91328a724369b2e1d83369c) +--- + daemons/lvmlockd/lvmlockd-sanlock.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c +index 17820b91d..f06af6c60 100644 +--- a/daemons/lvmlockd/lvmlockd-sanlock.c ++++ b/daemons/lvmlockd/lvmlockd-sanlock.c +@@ -367,7 +367,7 @@ static int write_info_file(struct lockspace *ls) + struct lm_sanlock *lms = (struct lm_sanlock *)ls->lm_data; + char path[PATH_MAX] = { 0 }; + FILE *fp; +- time_t t; ++ time_t t = time(NULL); + + if (dm_snprintf(path, PATH_MAX-1, "/var/lib/lvm/lvmlockd_info_%s", ls->vg_name) < 0) + return -1; +-- +2.53.0 + diff --git a/SOURCES/0061-libdaemon-CLOEXEC-descriptors-are-not-stray-fds.patch b/SOURCES/0061-libdaemon-CLOEXEC-descriptors-are-not-stray-fds.patch new file mode 100644 index 0000000..d0fe6e9 --- /dev/null +++ b/SOURCES/0061-libdaemon-CLOEXEC-descriptors-are-not-stray-fds.patch @@ -0,0 +1,66 @@ +From 7c9104595d223b6733e67e22ce8bb7eec0d33d91 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 19442f8c5..2589b0dd4 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 6dfe8dd..b4203e5 100644 --- a/SPECS/lvm2.spec +++ b/SPECS/lvm2.spec @@ -42,6 +42,7 @@ %global shortcommit %(c=%{commit}; echo ${c:0:7}) %endif #%%global rel_suffix .bz2141837 +%global rel_suffix .1 # Do not reset Release to 1 unless both lvm2 and device-mapper # versions are increased together. @@ -123,6 +124,11 @@ Patch55: 0055-log-add-string.h.patch Patch56: 0056-filesystem-refactor-code-working-with-xfs.patch Patch57: 0057-lib-rename-uuid.c-to-id.c.patch Patch58: 0058-autoreconf-reconfigure.patch +# static analysis issues: +Patch59: 0059-cov-fix-leaking-fd.patch +Patch60: 0060-lvmlockd-sanlock-fix-uninitialized-time-value.patch +# RHEL-153394: +Patch61: 0061-libdaemon-CLOEXEC-descriptors-are-not-stray-fds.patch BuildRequires: make BuildRequires: gcc @@ -756,6 +762,9 @@ An extensive functional testsuite for LVM2. %endif %changelog +* Mon Mar 09 2026 Marian Csontos - 2.03.33-4.el9_8.1 +- Fix false positive warnings about stray FDs on s390x. + * Thu Jan 15 2026 Marian Csontos - 2.03.33-4 - Handle wrong XFS reported size when shrinking LV immediately after growing.