From 8661865abd3eebba6256ede8d1702481426c60ad Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 18:52:54 +0100 Subject: [PATCH] revert upstream addition of nosymfollow patch (remove this revert when kernel 5.10 is mainstream) [release 2.36.1-2mamba;Wed Nov 18 2020] --- ...-linux-2.36.1-revert-add-nosymfollow.patch | 82 +++++++++++++++++++ util-linux.spec | 7 +- 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 util-linux-2.36.1-revert-add-nosymfollow.patch diff --git a/util-linux-2.36.1-revert-add-nosymfollow.patch b/util-linux-2.36.1-revert-add-nosymfollow.patch new file mode 100644 index 0000000..e2e57d9 --- /dev/null +++ b/util-linux-2.36.1-revert-add-nosymfollow.patch @@ -0,0 +1,82 @@ +From 73b193f8da0437d1b399903cf0f8e4c827adc03c Mon Sep 17 00:00:00 2001 +From: Mattias Nissler +Date: Thu, 17 Nov 2016 14:47:51 +0100 +Subject: [PATCH] mount: Add support for "nosymfollow" mount option. + +This adds support for the "nosymfollow" mount option, which indicates +that symlinks should not be traversed on the mount this option is +applied to. Also update the mount(8) man page with information about +this option. + +Signed-off-by: Mattias Nissler +Signed-off-by: Ross Zwisler +--- + libmount/src/context_mount.c | 2 ++ + libmount/src/libmount.h.in | 3 +++ + libmount/src/optmap.c | 4 ++++ + sys-utils/mount.8 | 10 ++++++++++ + 4 files changed, 19 insertions(+) + +diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c +index e0ef550b0..8c394c1ff 100644 +--- a/libmount/src/context_mount.c ++++ b/libmount/src/context_mount.c +@@ -422,6 +422,8 @@ static int generate_helper_optstr(struct libmnt_context *cxt, char **optstr) + mnt_optstr_append_option(optstr, "suid", NULL); + if (!(cxt->mountflags & MS_NODEV)) + mnt_optstr_append_option(optstr, "dev", NULL); ++ if (!(cxt->mountflags & MS_NOSYMFOLLOW)) ++ mnt_optstr_append_option(optstr, "symfollow", NULL); + } + + +diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in +index 321c0540b..e6710ae01 100644 +--- a/libmount/src/libmount.h.in ++++ b/libmount/src/libmount.h.in +@@ -941,6 +941,9 @@ extern int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status + #ifndef MS_DIRSYNC + #define MS_DIRSYNC 128 /* Directory modifications are synchronous */ + #endif ++#ifndef MS_NOSYMFOLLOW ++#define MS_NOSYMFOLLOW 256 /* Don't follow symlinks */ ++#endif + #ifndef MS_NOATIME + #define MS_NOATIME 0x400 /* 1024: Do not update access times. */ + #endif +diff --git a/libmount/src/optmap.c b/libmount/src/optmap.c +index a080d8df6..49e8113d2 100644 +--- a/libmount/src/optmap.c ++++ b/libmount/src/optmap.c +@@ -131,6 +131,10 @@ static const struct libmnt_optmap linux_flags_map[] = + { "rslave", MS_SLAVE | MS_REC, MNT_NOHLPS | MNT_NOMTAB }, + { "shared", MS_SHARED, MNT_NOHLPS | MNT_NOMTAB }, /* Shared */ + { "rshared", MS_SHARED | MS_REC, MNT_NOHLPS | MNT_NOMTAB }, ++#endif ++#ifdef MS_NOSYMFOLLOW ++ { "symfollow", MS_NOSYMFOLLOW, MNT_INVERT }, /* Don't follow symlinks */ ++ { "nosymfollow", MS_NOSYMFOLLOW }, + #endif + { NULL, 0, 0 } + }; +diff --git a/sys-utils/mount.8 b/sys-utils/mount.8 +index d633d25a4..d5fa55f43 100644 +--- a/sys-utils/mount.8 ++++ b/sys-utils/mount.8 +@@ -1472,6 +1472,16 @@ specifies the filesystem access mode used for + in octal notation. The default mode is 0755. This functionality is supported + only for root users or when mount executed without suid permissions. The option + is also supported as x-mount.mkdir, this notation is deprecated since v2.30. ++.TP ++.B nosymfollow ++Do not follow symlinks when resolving paths. Symlinks can still be created, ++and ++.BR readlink (1), ++.BR readlink (2), ++.BR realpath (1) ++and ++.BR realpath (3) ++all still work properly. + + .SH FILESYSTEM-SPECIFIC MOUNT OPTIONS + This section lists options that are specific to particular filesystems. diff --git a/util-linux.spec b/util-linux.spec index 33d920b..1c893df 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -8,7 +8,7 @@ Name: util-linux Version: 2.36.1 -Release: 1mamba +Release: 2mamba Epoch: 1 Summary: Miscellaneous utilities for Linux Group: System/Tools @@ -34,6 +34,7 @@ Patch0: %{name}-ng-2.12q-adjtime_path.patch Patch1: %{name}-ng-2.15-reiserfs_fix_name.patch Patch2: util-linux-2.22-su_paths.patch Patch3: util-linux-2.34-blkid-pkgconfig-add-uuid.patch +Patch4: util-linux-2.36.1-revert-add-nosymfollow.patch License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel @@ -175,6 +176,7 @@ This package provides the development file for application which use libfdisk. #%patch1 -p1 #%patch2 -p1 %patch3 -p1 +%patch4 -p1 -R cp %{S:1} nologin.c @@ -541,6 +543,9 @@ exit 0 %{_libdir}/pkgconfig/fdisk.pc %changelog +* Wed Nov 18 2020 Silvan Calarco 2.36.1-2mamba +- revert upstream addition of nosymfollow patch (remove this revert when kernel 5.10 is mainstream) + * Tue Nov 17 2020 Automatic Build System 2.36.1-1mamba - automatic version update by autodist