Libmount: Fix use option "owner" mount failed
When use option "owner" to mount, libmount replaces the "owner" and "group" mount options with "nosuid,nodev".
However, this can result in an "invaild 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, need to reverse the order of operations.
Signed-off-by: He, Xinzhe <dev03107@linx-info.com>
(cherry picked from commit 523b1d246e30a148cbd9d0258c0bc09554944875)
This commit is contained in:
parent
7934b83bb6
commit
c74f7915ba
39
mount-fix-use-option-owner-mount-failed.patch
Normal file
39
mount-fix-use-option-owner-mount-failed.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
From 0be7252a9227bf5f37d04d12c959cd317c0a0a18 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "He, Xinzhe" <xzhe@linx-info.com>
|
||||||
|
Date: Wed, 12 Mar 2025 20:33:10 +0800
|
||||||
|
Subject: [PATCH] mount-fix-use-option-owner-mount-failed
|
||||||
|
|
||||||
|
Signed-off-by: He, Xinzhe <xzhe@linx-info.com>
|
||||||
|
---
|
||||||
|
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
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Name: util-linux
|
Name: util-linux
|
||||||
Version: 2.39.1
|
Version: 2.39.1
|
||||||
Release: 17
|
Release: 18
|
||||||
Summary: A random collection of Linux utilities
|
Summary: A random collection of Linux utilities
|
||||||
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
|
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
|
URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
|
||||||
@ -99,6 +99,7 @@ Patch9000: SKIPPED-no-root-permissions-test.patch
|
|||||||
Patch9001: util-linux-Add-sw64-architecture.patch
|
Patch9001: util-linux-Add-sw64-architecture.patch
|
||||||
Patch9002: sfdisk-fix-crash-casued-by-out-of-bounds-access.patch
|
Patch9002: sfdisk-fix-crash-casued-by-out-of-bounds-access.patch
|
||||||
Patch9003: add-new-gmo-file.patch
|
Patch9003: add-new-gmo-file.patch
|
||||||
|
Patch9004: mount-fix-use-option-owner-mount-failed.patch
|
||||||
|
|
||||||
BuildRequires: audit-libs-devel >= 1.0.6 gettext-devel libselinux-devel ncurses-devel pam-devel zlib-devel popt-devel
|
BuildRequires: audit-libs-devel >= 1.0.6 gettext-devel libselinux-devel ncurses-devel pam-devel zlib-devel popt-devel
|
||||||
BuildRequires: libutempter-devel systemd-devel systemd libuser-devel libcap-ng-devel python3-devel gcc autoconf automake
|
BuildRequires: libutempter-devel systemd-devel systemd libuser-devel libcap-ng-devel python3-devel gcc autoconf automake
|
||||||
@ -475,6 +476,12 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Mar 12 2025 He, Xinzhe <dev03107@linx-info.com> - 2.39.1-18
|
||||||
|
- Type: bugfix
|
||||||
|
- CVE: NA
|
||||||
|
- SUG: NA
|
||||||
|
- DESC: fix use option "owner" mount failed
|
||||||
|
|
||||||
* Fri Feb 28 2025 yuanchicheng <chicheng.oerv@isrc.iscas.ac.cn> - 2.39.1-17
|
* Fri Feb 28 2025 yuanchicheng <chicheng.oerv@isrc.iscas.ac.cn> - 2.39.1-17
|
||||||
- Type: bugfix
|
- Type: bugfix
|
||||||
- CVE: NA
|
- CVE: NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user