util-linux: 2.41 -> 2.41.1 (#422015)

This commit is contained in:
Morgan Jones
2025-07-20 12:54:11 -07:00
committed by GitHub
5 changed files with 2 additions and 194 deletions
@@ -1,35 +0,0 @@
From e47c6f751a7ef87640c61316ada774e8e9cc6b07 Mon Sep 17 00:00:00 2001
From: Eugene Gershnik <gershnik@users.noreply.github.com>
Date: Mon, 6 May 2024 09:29:39 -0700
Subject: [PATCH] libuuid: fix uuid_time on macOS without attribute((alias))
Weak aliases are not supported by clang on Darwin.
Instead this fix uses inline asm to make `_uuid_time` an alias to
`___uuid_time`
It appears that on macOS the time API is purely 32 or 64 bit depending
on the build type. There is no ABI issue on that platform and `uuid_time`
can be unconditionally aliased to `_uuid_time`. This is all conjectural,
however, since I have no ability to make 32-bit builds for macOS - the
Apple toolchain doesn't support this since 2019.
Fixes util-linux/util-linux#2873
---
libuuid/src/uuid_time.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libuuid/src/uuid_time.c b/libuuid/src/uuid_time.c
index 9b415b3ee73..df0478e1909 100644
--- a/libuuid/src/uuid_time.c
+++ b/libuuid/src/uuid_time.c
@@ -85,6 +85,10 @@ time_t __uuid_time(const uuid_t uu, struct timeval *ret_tv)
}
#if defined(__USE_TIME_BITS64) && defined(__GLIBC__)
extern time_t uuid_time64(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time")));
+#elif defined(__clang__) && defined(__APPLE__)
+__asm__(".globl _uuid_time");
+__asm__(".set _uuid_time, ___uuid_time");
+extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv);
#else
extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time")));
#endif
@@ -1,39 +0,0 @@
From 7dbfe31a83f45d5aef2b508697e9511c569ffbc8 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 24 Mar 2025 14:31:05 +0100
Subject: [PATCH] libmount: fix --no-canonicalize regression
Fixes: https://github.com/util-linux/util-linux/issues/3474
Signed-off-by: Karel Zak <kzak@redhat.com>
---
libmount/src/context.c | 3 ---
sys-utils/mount.8.adoc | 2 +-
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/libmount/src/context.c b/libmount/src/context.c
index 0323cb23d34..15a8ad3bbd0 100644
--- a/libmount/src/context.c
+++ b/libmount/src/context.c
@@ -530,9 +530,6 @@ int mnt_context_is_xnocanonicalize(
assert(cxt);
assert(type);
- if (mnt_context_is_nocanonicalize(cxt))
- return 1;
-
ol = mnt_context_get_optlist(cxt);
if (!ol)
return 0;
diff --git a/sys-utils/mount.8.adoc b/sys-utils/mount.8.adoc
index 4f23f8d1f0e..5103b91c578 100644
--- a/sys-utils/mount.8.adoc
+++ b/sys-utils/mount.8.adoc
@@ -756,7 +756,7 @@ Allow to make a target directory (mountpoint) if it does not exist yet. The opti
*X-mount.nocanonicalize*[**=**_type_]::
Allows disabling of canonicalization for mount source and target paths. By default, the `mount` command resolves all paths to their absolute paths without symlinks. However, this behavior may not be desired in certain situations, such as when binding a mount over a symlink, or a symlink over a directory or another symlink. The optional argument _type_ can be either "source" or "target" (mountpoint). If no _type_ is specified, then canonicalization is disabled for both types. This mount option does not affect the conversion of source tags (e.g. LABEL= or UUID=) and fstab processing.
+
-The command line option *--no-canonicalize* overrides this mount option and affects all path and tag conversions in all situations, but it does not modify flags for open_tree syscalls.
+The command-line option *--no-canonicalize* overrides this mount option and affects all path and tag conversions in all situations, but for backward compatibility, it does not modify open_tree syscall flags and does not allow the bind-mount over a symlink use case.
+
Note that *mount*(8) still sanitizes and canonicalizes the source and target paths specified on the command line by non-root users, regardless of the X-mount.nocanonicalize setting.
@@ -1,31 +0,0 @@
From cfb80587da7bf3d6a8eeb9b846702d6d731aa1c6 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 9 Apr 2025 11:32:08 +0200
Subject: [PATCH] libmount: (subdir) remove unused code
The optlist already handles quoted values, so there's no need to do it
in the callers.
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 5462fa3435544344727b8644205ae427dfd5fcba)
---
libmount/src/hook_subdir.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libmount/src/hook_subdir.c b/libmount/src/hook_subdir.c
index 5949af7d8..1e5d79958 100644
--- a/libmount/src/hook_subdir.c
+++ b/libmount/src/hook_subdir.c
@@ -329,9 +329,6 @@ static int is_subdir_required(struct libmnt_context *cxt, int *rc, char **subdir
dir = mnt_opt_get_value(opt);
- if (dir && *dir == '"')
- dir++;
-
if (!dir || !*dir) {
DBG(HOOK, ul_debug("failed to parse X-mount.subdir '%s'", dir));
*rc = -MNT_ERR_MOUNTOPT;
--
2.49.0
@@ -1,80 +0,0 @@
From 22b91501d30a65d25ecf48ce5169ec70848117b8 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 9 Apr 2025 12:15:57 +0200
Subject: [PATCH] libmount: (subdir) restrict for real mounts only
It's now possible to use, for example, for bind operations, but it
does not make sense as you can specify the target with the
subdirectory.
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 437a271f7108f689d350f1b3d837490d3d283c3c)
---
libmount/src/hook_subdir.c | 21 ++++++++++++++++-----
sys-utils/mount.8.adoc | 6 ++++--
2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/libmount/src/hook_subdir.c b/libmount/src/hook_subdir.c
index 1e5d79958..7cbb2c88d 100644
--- a/libmount/src/hook_subdir.c
+++ b/libmount/src/hook_subdir.c
@@ -313,6 +313,7 @@ static int is_subdir_required(struct libmnt_context *cxt, int *rc, char **subdir
struct libmnt_optlist *ol;
struct libmnt_opt *opt;
const char *dir = NULL;
+ unsigned long flags = 0;
assert(cxt);
assert(rc);
@@ -328,16 +329,26 @@ static int is_subdir_required(struct libmnt_context *cxt, int *rc, char **subdir
return 0;
dir = mnt_opt_get_value(opt);
-
if (!dir || !*dir) {
DBG(HOOK, ul_debug("failed to parse X-mount.subdir '%s'", dir));
*rc = -MNT_ERR_MOUNTOPT;
- } else {
- *subdir = strdup(dir);
- if (!*subdir)
- *rc = -ENOMEM;
+ return 0;
+ }
+
+ *rc = mnt_optlist_get_flags(ol, &flags, cxt->map_linux, 0);
+ if (*rc)
+ return 0;
+
+ if (flags & MS_REMOUNT || flags & MS_BIND || flags & MS_MOVE
+ || mnt_context_propagation_only(cxt)) {
+ DBG(HOOK, ul_debug("ignore subdir= (bind/move/remount/..)"));
+ return 0;
}
+ *subdir = strdup(dir);
+ if (!*subdir)
+ *rc = -ENOMEM;
+
return *rc == 0;
}
diff --git a/sys-utils/mount.8.adoc b/sys-utils/mount.8.adoc
index 6a17cd5eb..d9ce31fd4 100644
--- a/sys-utils/mount.8.adoc
+++ b/sys-utils/mount.8.adoc
@@ -763,8 +763,10 @@ Note that *mount*(8) still sanitizes and canonicalizes the source and target pat
*X-mount.noloop*::
Do not create and mount a loop device, even if the source of the mount is a regular file.
-*X-mount.subdir=*__directory__::
-Allow mounting sub-directory from a filesystem instead of the root directory. For now, this feature is implemented by temporary filesystem root directory mount in unshared namespace and then bind the sub-directory to the final mount point and umount the root of the filesystem. The sub-directory mount shows up atomically for the rest of the system although it is implemented by multiple *mount*(2) syscalls.
+**X-mount.subdir=**_directory_::
+Allow mounting a subdirectory of a filesystem instead of the root directory. This is effective only when a new instance of a filesystem is attached to the system. The option is silently ignored for operations like remount, bind mount, or move.
++
+For now, this feature is implemented by a temporary filesystem root-directory mount in an unshared namespace and then binding the sub-directory to the final mount point and unmounting the root of the filesystem. The sub-directory mount shows up atomically for the rest of the system although it is implemented by multiple *mount*(2) syscalls.
+
Note that this feature will not work in session with an unshared private mount namespace (after *unshare --mount*) on old kernels or with *mount*(8) without support for file-descriptors-based mount kernel API. In this case, you need *unshare --mount --propagation shared*.
+
--
2.49.0
+2 -9
View File
@@ -36,23 +36,16 @@ let
in
stdenv.mkDerivation (finalPackage: rec {
pname = "util-linux" + lib.optionalString isMinimal "-minimal";
version = "2.41";
version = "2.41.1";
src = fetchurl {
url = "mirror://kernel/linux/utils/util-linux/v${lib.versions.majorMinor version}/util-linux-${version}.tar.xz";
hash = "sha256-ge6Ts8/f6318QJDO3rode7zpFB/QtQG2hrP+R13cpMY=";
hash = "sha256-vprZonb0MFq33S9SJci+H/VDUvVl/03t6WKMGqp97Fc=";
};
patches =
[
./rtcwake-search-PATH-for-shutdown.patch
# https://github.com/util-linux/util-linux/pull/3013
./fix-darwin-build.patch
# https://github.com/util-linux/util-linux/pull/3479 (fixes https://github.com/util-linux/util-linux/issues/3474)
./fix-mount-regression.patch
# https://github.com/util-linux/util-linux/pull/3530
./libmount-subdir-remove-unused-code.patch
./libmount-subdir-restrict-for-real-mounts-only.patch
]
++ lib.optionals (!stdenv.hostPlatform.isLinux) [
(fetchurl {