diff --git a/backport-mount-fix-use-option-owner-mount-failed.patch b/backport-mount-fix-use-option-owner-mount-failed.patch new file mode 100644 index 0000000000000000000000000000000000000000..4d62234d85f51f0295ad3836911c98ca589c74d0 --- /dev/null +++ b/backport-mount-fix-use-option-owner-mount-failed.patch @@ -0,0 +1,47 @@ +From 4aa39b894dbb80eab45af53a011224a43b687b94 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 24 Feb 2025 14:04:53 +0100 +Subject: [PATCH] Libmount: Fix removal of "owner" option when executed as root + +When executed as root, libmount replaces the "owner" and "group" mount +options with "nosuid, nodev, ..." However, this can result in an +"invalid argument" error because libmount removes the unwanted options +first and then tries to address the location for the new options using +the already removed options. To fix this, we need to reverse the order +of operations. + +Reported-by: hxinzhe +Signed-off-by: Karel Zak +--- + libmount/src/context_mount.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c +index 50e4a62..4eaeb31 100644 +--- a/libmount/src/context_mount.c ++++ b/libmount/src/context_mount.c +@@ -202,10 +202,6 @@ static int evaluate_permissions(struct libmnt_context *cxt) + * + * The old deprecated way is to use mnt_optstr_get_flags(). + */ +- if (user_flags & (MNT_MS_OWNER | MNT_MS_GROUP)) +- rc = mnt_optlist_remove_flags(ol, +- MNT_MS_OWNER | MNT_MS_GROUP, cxt->map_userspace); +- + if (!rc && (user_flags & MNT_MS_OWNER)) + rc = mnt_optlist_insert_flags(ol, + MS_OWNERSECURE, cxt->map_linux, +@@ -226,6 +222,10 @@ static int evaluate_permissions(struct libmnt_context *cxt) + rc = mnt_optlist_insert_flags(ol, MS_SECURE, cxt->map_linux, + MNT_MS_USERS, cxt->map_userspace); + ++ if (user_flags & (MNT_MS_OWNER | MNT_MS_GROUP)) ++ rc = mnt_optlist_remove_flags(ol, ++ MNT_MS_OWNER | MNT_MS_GROUP, cxt->map_userspace); ++ + DBG(CXT, ul_debugobj(cxt, "perms: superuser [rc=%d]", rc)); + if (rc) + return rc; +-- +2.43.0 + diff --git a/util-linux.spec b/util-linux.spec index 268f972f5e1ef9bc27d0a70f0094066355133637..5b25cbdb2716c1cbbea54d53b8b0b8f6a074524d 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -3,7 +3,7 @@ Name: util-linux Version: 2.40.4 -Release: 2 +Release: 3 Summary: A random collection of Linux utilities License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git @@ -36,6 +36,7 @@ Patch6014: backport-sulogin-fix-POSIX-locale-use.patch Patch6015: backport-setpriv.c-fix-memory-leak-in-parse_groups-function.patch Patch6016: backport-whereis-avoid-accessing-uninitialized-memory.patch Patch6017: backport-dmesg-fix-notime-use.patch +Patch6018: backport-mount-fix-use-option-owner-mount-failed.patch Patch9000: SKIPPED-no-root-permissions-test.patch Patch9001: util-linux-Add-sw64-architecture.patch @@ -421,6 +422,12 @@ fi %endif %changelog +* Thu Mar 27 2025 wangjiang - 2.40.4-3 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:Fix use option "owner" mount failed + * Thu Mar 27 2025 zhangyao - 2.40.4-2 - Type:bugfix - CVE:NA