summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/util-linux/files')
-rw-r--r--sys-apps/util-linux/files/su-l.pamd5
-rw-r--r--sys-apps/util-linux/files/util-linux-2.32.1-skip-oids-test-when-uuidgen-is-not-available.patch41
-rw-r--r--sys-apps/util-linux/files/util-linux-2.33-sparc-setarch.patch80
-rw-r--r--sys-apps/util-linux/files/util-linux-2.33.1-fix-struct_termios-check.patch30
-rw-r--r--sys-apps/util-linux/files/util-linux-2.39.2-backport-1d4456d.patch33
-rw-r--r--sys-apps/util-linux/files/util-linux-2.39.2-backport-pr2251.patch268
-rw-r--r--sys-apps/util-linux/files/util-linux-2.39.2-fincore-test.patch23
-rw-r--r--sys-apps/util-linux/files/util-linux-2.39.3-CVE-2024-28085.patch25
-rw-r--r--sys-apps/util-linux/files/util-linux-2.39.3-fix-use-after-free.patch52
-rw-r--r--sys-apps/util-linux/files/util-linux-2.39.3-libblkid-luks.patch40
-rw-r--r--sys-apps/util-linux/files/util-linux-2.39.3-libmount-Fix-export-of-mnt_context_is_lazy-and-mnt_c.patch55
-rw-r--r--sys-apps/util-linux/files/util-linux-2.39.3-musl-1.2.5-basename.patch56
-rw-r--r--sys-apps/util-linux/files/util-linux-2.39.4-umount-readonly.patch35
-rw-r--r--sys-apps/util-linux/files/uuidd.initd17
14 files changed, 609 insertions, 151 deletions
diff --git a/sys-apps/util-linux/files/su-l.pamd b/sys-apps/util-linux/files/su-l.pamd
new file mode 100644
index 000000000000..24f29d751f9f
--- /dev/null
+++ b/sys-apps/util-linux/files/su-l.pamd
@@ -0,0 +1,5 @@
+auth include su
+account include su
+password include su
+session optional pam_lastlog.so
+session include su
diff --git a/sys-apps/util-linux/files/util-linux-2.32.1-skip-oids-test-when-uuidgen-is-not-available.patch b/sys-apps/util-linux/files/util-linux-2.32.1-skip-oids-test-when-uuidgen-is-not-available.patch
deleted file mode 100644
index 743dc89e2425..000000000000
--- a/sys-apps/util-linux/files/util-linux-2.32.1-skip-oids-test-when-uuidgen-is-not-available.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 8f93c8c71d264e90bdcecf98c9ac372bbcdc53aa Mon Sep 17 00:00:00 2001
-From: Thomas Deutschmann <whissi@gentoo.org>
-Date: Sun, 11 Nov 2018 02:17:55 +0100
-Subject: [PATCH] tests: run oids test only when uuidgen tool was built
-
-oids test did not check if uuidgen was available.
-
-oids test was also calling uuidgen from PATH which could result
-in wrong results if uuidgen from a previous util-linux installation
-was used.
-
-With this commit we will check if uuidgen was built and make sure
-that we only call the uuidgen binary we just built. If uuidgen is
-not available we will skip this test.
----
- tests/ts/uuid/oids | 10 ++++++----
- 1 file changed, 6 insertions(+), 4 deletions(-)
-
-diff --git a/tests/ts/uuid/oids b/tests/ts/uuid/oids
-index 3b005c5b2..77e010c1d 100755
---- a/tests/ts/uuid/oids
-+++ b/tests/ts/uuid/oids
-@@ -20,12 +20,14 @@ ts_init "$*"
-
- : . > $TS_OUTPUT
-
--uuidgen --md5 --namespace @dns --name "www.widgets.com" >> $TS_OUTPUT
-+ts_check_test_command "$TS_CMD_UUIDGEN"
-
--uuidgen --md5 --namespace @dns --name "www.example.com" >> $TS_OUTPUT
-+$TS_CMD_UUIDGEN --md5 --namespace @dns --name "www.widgets.com" >> $TS_OUTPUT
-
--uuidgen --sha1 --namespace @dns --name "www.example.com" >> $TS_OUTPUT
-+$TS_CMD_UUIDGEN --md5 --namespace @dns --name "www.example.com" >> $TS_OUTPUT
-
--uuidgen --sha1 --namespace @oid --hex --name "525400fc0f5e" >> $TS_OUTPUT
-+$TS_CMD_UUIDGEN --sha1 --namespace @dns --name "www.example.com" >> $TS_OUTPUT
-+
-+$TS_CMD_UUIDGEN --sha1 --namespace @oid --hex --name "525400fc0f5e" >> $TS_OUTPUT
-
- ts_finalize
diff --git a/sys-apps/util-linux/files/util-linux-2.33-sparc-setarch.patch b/sys-apps/util-linux/files/util-linux-2.33-sparc-setarch.patch
deleted file mode 100644
index cbae6c0f2631..000000000000
--- a/sys-apps/util-linux/files/util-linux-2.33-sparc-setarch.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From 3fa06e049012218d883d0e1251df86bafbc446bf Mon Sep 17 00:00:00 2001
-From: Karel Zak <kzak@redhat.com>
-Date: Thu, 22 Nov 2018 11:03:35 +0100
-Subject: [PATCH] setarch: fix obscure sparc32bash use-case
-
-Reported-by: Carlos Santos <casantos@datacom.com.br>
-Signed-off-by: Karel Zak <kzak@redhat.com>
----
- sys-utils/setarch.c | 28 ++++++++++++++++++----------
- 1 file changed, 18 insertions(+), 10 deletions(-)
-
-diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
-index a733f7b3c..7c0a63fbb 100644
---- a/sys-utils/setarch.c
-+++ b/sys-utils/setarch.c
-@@ -268,6 +268,7 @@ int main(int argc, char *argv[])
- int c;
- struct arch_domain *doms, *target;
- unsigned long pers_value = 0;
-+ char *shell = NULL, *shell_arg = NULL;
-
- /* Options without equivalent short options */
- enum {
-@@ -310,14 +311,14 @@ int main(int argc, char *argv[])
- archwrapper = strcmp(program_invocation_short_name, "setarch") != 0;
- if (archwrapper) {
- arch = program_invocation_short_name; /* symlinks to setarch */
--#if defined(__sparc64__) || defined(__sparc__)
-+
-+ /* Don't use ifdef sparc here, we get "Unrecognized architecture"
-+ * error message later if necessary */
- if (strcmp(arch, "sparc32bash") == 0) {
-- if (set_arch(arch, 0L, 0))
-- err(EXIT_FAILURE, _("Failed to set personality to %s"), arch);
-- execl("/bin/bash", "", NULL);
-- errexec("/bin/bash");
-+ shell = "/bin/bash";
-+ shell_arg = "";
-+ goto set_arch;
- }
--#endif
- } else {
- if (1 < argc && *argv[1] != '-') {
- arch = argv[1];
-@@ -391,6 +392,7 @@ int main(int argc, char *argv[])
- argc -= optind;
- argv += optind;
-
-+set_arch:
- /* get execution domain (architecture) */
- if (arch) {
- doms = init_arch_domains();
-@@ -422,17 +424,23 @@ int main(int argc, char *argv[])
- if (arch)
- verify_arch_domain(target, arch);
-
-+ if (!argc) {
-+ shell = "/bin/sh";
-+ shell_arg = "-sh";
-+ }
- if (verbose) {
-- printf(_("Execute command `%s'.\n"), argc ? argv[0] : "/bin/sh");
-+ printf(_("Execute command `%s'.\n"), shell ? shell : argv[0]);
- /* flush all output streams before exec */
- fflush(NULL);
- }
-
-- if (!argc) {
-- execl("/bin/sh", "-sh", NULL);
-- errexec("/bin/sh");
-+ /* Execute shell */
-+ if (shell) {
-+ execl(shell, shell_arg, NULL);
-+ errexec(shell);
- }
-
-+ /* Execute on command line specified command */
- execvp(argv[0], argv);
- errexec(argv[0]);
- }
diff --git a/sys-apps/util-linux/files/util-linux-2.33.1-fix-struct_termios-check.patch b/sys-apps/util-linux/files/util-linux-2.33.1-fix-struct_termios-check.patch
deleted file mode 100644
index df52af45049b..000000000000
--- a/sys-apps/util-linux/files/util-linux-2.33.1-fix-struct_termios-check.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 963413a1adf6767ab17712097e288e1a346f63a7 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 4 Jan 2019 22:38:25 -0800
-Subject: [PATCH] ldattach: Check for value of _HAVE_STRUCT_TERMIOS_C_ISPEED
-
-in glibc 2.29+ checking for just existence of _HAVE_STRUCT_TERMIOS_C_ISPEED
-won't be enough, the value has to be checked
-
-see
-https://sourceware.org/git/?p=glibc.git;a=commit;h=e5a50db36eaa6e8c6427b3a971563240b633ca85
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- sys-utils/ldattach.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sys-utils/ldattach.c b/sys-utils/ldattach.c
-index d33d68535..fb50711eb 100644
---- a/sys-utils/ldattach.c
-+++ b/sys-utils/ldattach.c
-@@ -242,7 +242,7 @@ static int my_cfsetspeed(struct termios *ts, int speed)
- * -- we have to bypass glibc and set the speed manually (because glibc
- * checks for speed and supports Bxxx bit rates only)...
- */
--#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
-+#if _HAVE_STRUCT_TERMIOS_C_ISPEED
- # define BOTHER 0010000 /* non standard rate */
- dbg("using non-standard speeds");
- ts->c_ospeed = ts->c_ispeed = speed;
-
diff --git a/sys-apps/util-linux/files/util-linux-2.39.2-backport-1d4456d.patch b/sys-apps/util-linux/files/util-linux-2.39.2-backport-1d4456d.patch
new file mode 100644
index 000000000000..3cce0bcab453
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.39.2-backport-1d4456d.patch
@@ -0,0 +1,33 @@
+https://bugs.gentoo.org/920904
+https://github.com/util-linux/util-linux/commit/1d4456dd81a64a73685df9e5f1232d566818e453
+
+From 1d4456dd81a64a73685df9e5f1232d566818e453 Mon Sep 17 00:00:00 2001
+From: John David Anglin <dave@parisc-linux.org>
+Date: Mon, 7 Aug 2023 15:37:17 +0000
+Subject: [PATCH] enosys: fix build on hppa
+
+The following patch fixes the definition of SECCOMP_ARCH_NATIVE
+on hppa.
+
+Signed-off-by: John David Anglin <dave.anglin@bell.net>
+---
+ include/audit-arch.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/include/audit-arch.h b/include/audit-arch.h
+index 63d9eb52c1..f1354eec5d 100644
+--- a/include/audit-arch.h
++++ b/include/audit-arch.h
+@@ -57,6 +57,12 @@
+ # else
+ # define SECCOMP_ARCH_NATIVE AUDIT_ARCH_LOONGARCH64
+ # endif
++#elif __hppa__
++# if __SIZEOF_POINTER__ == 4
++# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PARISC
++# else
++# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PARISC64
++# endif
+ #else
+ # error Unknown target architecture
+ #endif
diff --git a/sys-apps/util-linux/files/util-linux-2.39.2-backport-pr2251.patch b/sys-apps/util-linux/files/util-linux-2.39.2-backport-pr2251.patch
new file mode 100644
index 000000000000..b16519bb5142
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.39.2-backport-pr2251.patch
@@ -0,0 +1,268 @@
+https://bugs.gentoo.org/914791
+https://github.com/util-linux/util-linux/issues/2249
+https://github.com/util-linux/util-linux/pull/2251
+
+From 8b36444f447949c3ab477f2c43b45a94c30ee7bf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
+Date: Sun, 21 May 2023 21:42:14 +0200
+Subject: [PATCH 1/4] fadvise: (test) dynamically calculate expected test
+ values
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
+---
+ tests/ts/fadvise/drop | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/tests/ts/fadvise/drop b/tests/ts/fadvise/drop
+index 7c7eee5dc2..86c0d5b0a3 100755
+--- a/tests/ts/fadvise/drop
++++ b/tests/ts/fadvise/drop
+@@ -16,7 +16,7 @@ ts_check_prog "sleep"
+ ts_cd "$TS_OUTDIR"
+
+ FILE="ddtest"
+-BS=4k
++BS=4096
+ COUNT=8
+
+ FILE_FS="$("$TS_CMD_FINDMNT" -nr -o FSTYPE -T "$PWD")"
+@@ -41,22 +41,22 @@ create_file() {
+ echo
+
+ create_file
+- echo "offset: 8192"
+- "$TS_CMD_FADVISE" -o 8192 "$FILE"
++ echo "offset: $(( 2 * $BS ))"
++ "$TS_CMD_FADVISE" -o $(( 2 * $BS )) "$FILE"
+ echo status: $?
+ "$TS_CMD_FINCORE" "$FILE"
+ echo
+
+ create_file
+- echo "length: 16384"
+- "$TS_CMD_FADVISE" -l 16384 "$FILE"
++ echo "length: $(( 4 * $BS ))"
++ "$TS_CMD_FADVISE" -l $(( 4 * $BS )) "$FILE"
+ echo status: $?
+ "$TS_CMD_FINCORE" "$FILE"
+ echo
+
+ create_file
+- echo "offset: 8192, length: 16384 fd: 42"
+- "$TS_CMD_FADVISE" -o 8192 -l 16384 --fd 42 42<"$FILE"
++ echo "offset: $(( 2 * $BS )), length: $(( 4 * $BS )) fd: 42"
++ "$TS_CMD_FADVISE" -o $(( 2 * $BS )) -l $(( 4 * $BS )) --fd 42 42<"$FILE"
+ echo status: $?
+ "$TS_CMD_FINCORE" "$FILE"
+ echo
+
+From e5009e773fc801eca887dd43b721cd1b1aa327be Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
+Date: Sun, 21 May 2023 21:43:38 +0200
+Subject: [PATCH 2/4] fadvise: (tests) factor out calls to "fincore"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This will make it easier to pass argument later.
+
+Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
+---
+ tests/ts/fadvise/drop | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/tests/ts/fadvise/drop b/tests/ts/fadvise/drop
+index 86c0d5b0a3..8869b7da4d 100755
+--- a/tests/ts/fadvise/drop
++++ b/tests/ts/fadvise/drop
+@@ -28,37 +28,41 @@ create_file() {
+ dd if=/dev/zero of="$FILE" bs=$BS count=$COUNT conv=fsync >& /dev/null
+ }
+
++do_fincore() {
++ "$TS_CMD_FINCORE" "$FILE"
++}
++
+ {
+ create_file
+- "$TS_CMD_FINCORE" "$FILE"
++ do_fincore
+ echo
+
+ create_file
+ echo "whole file"
+ "$TS_CMD_FADVISE" "$FILE"
+ echo status: $?
+- "$TS_CMD_FINCORE" "$FILE"
++ do_fincore
+ echo
+
+ create_file
+ echo "offset: $(( 2 * $BS ))"
+ "$TS_CMD_FADVISE" -o $(( 2 * $BS )) "$FILE"
+ echo status: $?
+- "$TS_CMD_FINCORE" "$FILE"
++ do_fincore
+ echo
+
+ create_file
+ echo "length: $(( 4 * $BS ))"
+ "$TS_CMD_FADVISE" -l $(( 4 * $BS )) "$FILE"
+ echo status: $?
+- "$TS_CMD_FINCORE" "$FILE"
++ do_fincore
+ echo
+
+ create_file
+ echo "offset: $(( 2 * $BS )), length: $(( 4 * $BS )) fd: 42"
+ "$TS_CMD_FADVISE" -o $(( 2 * $BS )) -l $(( 4 * $BS )) --fd 42 42<"$FILE"
+ echo status: $?
+- "$TS_CMD_FINCORE" "$FILE"
++ do_fincore
+ echo
+
+ rm "$FILE"
+
+From 33980996d0b429fc59c40f8352633c0a21a0f96a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
+Date: Sun, 21 May 2023 21:44:20 +0200
+Subject: [PATCH 3/4] fadvise: (test) don't compare fincore page counts
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+These depend on the machines pagesize and are therefore not a good
+comparision.
+
+Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
+---
+ tests/expected/fadvise/drop | 20 ++++++++++----------
+ tests/ts/fadvise/drop | 2 +-
+ 2 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/tests/expected/fadvise/drop b/tests/expected/fadvise/drop
+index f2360b56fb..25f23e050a 100644
+--- a/tests/expected/fadvise/drop
++++ b/tests/expected/fadvise/drop
+@@ -1,23 +1,23 @@
+- RES PAGES SIZE FILE
+- 32K 8 32K ddtest
++ RES SIZE FILE
++ 32K 32K ddtest
+
+ whole file
+ status: 0
+-RES PAGES SIZE FILE
+- 0B 0 32K ddtest
++RES SIZE FILE
++ 0B 32K ddtest
+
+ offset: 8192
+ status: 0
+-RES PAGES SIZE FILE
+- 8K 2 32K ddtest
++RES SIZE FILE
++ 8K 32K ddtest
+
+ length: 16384
+ status: 0
+- RES PAGES SIZE FILE
+- 16K 4 32K ddtest
++ RES SIZE FILE
++ 16K 32K ddtest
+
+ offset: 8192, length: 16384 fd: 42
+ status: 0
+- RES PAGES SIZE FILE
+- 16K 4 32K ddtest
++ RES SIZE FILE
++ 16K 32K ddtest
+
+diff --git a/tests/ts/fadvise/drop b/tests/ts/fadvise/drop
+index 8869b7da4d..6c4298e872 100755
+--- a/tests/ts/fadvise/drop
++++ b/tests/ts/fadvise/drop
+@@ -29,7 +29,7 @@ create_file() {
+ }
+
+ do_fincore() {
+- "$TS_CMD_FINCORE" "$FILE"
++ "$TS_CMD_FINCORE" -o RES,SIZE,FILE "$FILE"
+ }
+
+ {
+
+From c0f31b79f5d1c665cdc057fb32f4d161d28aa5b2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
+Date: Sun, 21 May 2023 21:45:10 +0200
+Subject: [PATCH 4/4] fadvise: (test) test with 64k blocks
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This will allow the tests to also pass on systems with 64k pagesizes.
+
+Closes #2249
+Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
+---
+ tests/expected/fadvise/drop | 26 +++++++++++++-------------
+ tests/ts/fadvise/drop | 2 +-
+ 2 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/tests/expected/fadvise/drop b/tests/expected/fadvise/drop
+index 25f23e050a..e7bb26b6e2 100644
+--- a/tests/expected/fadvise/drop
++++ b/tests/expected/fadvise/drop
+@@ -1,23 +1,23 @@
+- RES SIZE FILE
+- 32K 32K ddtest
++ RES SIZE FILE
++ 512K 512K ddtest
+
+ whole file
+ status: 0
+-RES SIZE FILE
+- 0B 32K ddtest
++RES SIZE FILE
++ 0B 512K ddtest
+
+-offset: 8192
++offset: 131072
+ status: 0
+-RES SIZE FILE
+- 8K 32K ddtest
++ RES SIZE FILE
++ 128K 512K ddtest
+
+-length: 16384
++length: 262144
+ status: 0
+- RES SIZE FILE
+- 16K 32K ddtest
++ RES SIZE FILE
++ 256K 512K ddtest
+
+-offset: 8192, length: 16384 fd: 42
++offset: 131072, length: 262144 fd: 42
+ status: 0
+- RES SIZE FILE
+- 16K 32K ddtest
++ RES SIZE FILE
++ 256K 512K ddtest
+
+diff --git a/tests/ts/fadvise/drop b/tests/ts/fadvise/drop
+index 6c4298e872..45dcb9110b 100755
+--- a/tests/ts/fadvise/drop
++++ b/tests/ts/fadvise/drop
+@@ -16,7 +16,7 @@ ts_check_prog "sleep"
+ ts_cd "$TS_OUTDIR"
+
+ FILE="ddtest"
+-BS=4096
++BS=65536
+ COUNT=8
+
+ FILE_FS="$("$TS_CMD_FINDMNT" -nr -o FSTYPE -T "$PWD")"
diff --git a/sys-apps/util-linux/files/util-linux-2.39.2-fincore-test.patch b/sys-apps/util-linux/files/util-linux-2.39.2-fincore-test.patch
new file mode 100644
index 000000000000..f69876fe0a18
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.39.2-fincore-test.patch
@@ -0,0 +1,23 @@
+https://bugs.gentoo.org/627532
+https://github.com/util-linux/util-linux/commit/f5715c117e727d4ff45e0d8568f188753620356e
+
+From f5715c117e727d4ff45e0d8568f188753620356e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
+Date: Mon, 13 Nov 2023 21:05:59 +0100
+Subject: [PATCH] fincore: (tests) also use nosize error file
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Link: https://lore.kernel.org/util-linux/b8cafd0d89878949705782312dfe800ec2779035.camel@physik.fu-berlin.de/
+Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
+--- a/tests/ts/fincore/count
++++ b/tests/ts/fincore/count
+@@ -107,6 +107,7 @@ if test -f "$TS_EXPECTED.$PAGE_SIZE"; then
+ OUT_COLUMNS="PAGES,SIZE,FILE"
+ else
+ TS_EXPECTED+=".nosize"
++ TS_EXPECTED_ERR+=".nosize"
+ OUT_COLUMNS="PAGES,FILE"
+ fi
+
diff --git a/sys-apps/util-linux/files/util-linux-2.39.3-CVE-2024-28085.patch b/sys-apps/util-linux/files/util-linux-2.39.3-CVE-2024-28085.patch
new file mode 100644
index 000000000000..99092c05aa7e
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.39.3-CVE-2024-28085.patch
@@ -0,0 +1,25 @@
+https://bugs.gentoo.org/927980
+https://people.rit.edu/sjf5462/6831711781/wall_2_27_2024.txt
+https://github.com/util-linux/util-linux/commit/404b0781f52f7c045ca811b2dceec526408ac253
+
+From 404b0781f52f7c045ca811b2dceec526408ac253 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Thu, 21 Mar 2024 11:16:20 +0100
+Subject: [PATCH] wall: fix escape sequence Injection [CVE-2024-28085]
+
+Let's use for all cases the same output function.
+
+Reported-by: Skyler Ferrante <sjf5462@rit.edu>
+Signed-off-by: Karel Zak <kzak@redhat.com>
+--- a/term-utils/wall.c
++++ b/term-utils/wall.c
+@@ -368,7 +368,7 @@ static char *makemsg(char *fname, char **mvec, int mvecsz,
+ int i;
+
+ for (i = 0; i < mvecsz; i++) {
+- fputs(mvec[i], fs);
++ fputs_careful(mvec[i], fs, '^', true, TERM_WIDTH);
+ if (i < mvecsz - 1)
+ fputc(' ', fs);
+ }
+
diff --git a/sys-apps/util-linux/files/util-linux-2.39.3-fix-use-after-free.patch b/sys-apps/util-linux/files/util-linux-2.39.3-fix-use-after-free.patch
new file mode 100644
index 000000000000..6ebbd0a430f7
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.39.3-fix-use-after-free.patch
@@ -0,0 +1,52 @@
+https://bugs.gentoo.org/928396
+https://github.com/util-linux/util-linux/commit/4b2e6f5071a4c5beebbd9668d24dc05defc096d7
+
+From 4b2e6f5071a4c5beebbd9668d24dc05defc096d7 Mon Sep 17 00:00:00 2001
+From: Tanish Yadav <devtany@gmail.com>
+Date: Tue, 5 Mar 2024 00:51:41 +0530
+Subject: [PATCH] su: fix use after free in run_shell
+
+Do not free tmp for non login branch as basename may return a pointer to
+some part of it.
+
+[kzak@redhat.com: - improve coding style of the function]
+
+Signed-off-by: Tanish Yadav <devtany@gmail.com>
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+ login-utils/su-common.c | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/login-utils/su-common.c b/login-utils/su-common.c
+index 242b6ce4ea..9bc0231961 100644
+--- a/login-utils/su-common.c
++++ b/login-utils/su-common.c
+@@ -835,13 +835,14 @@ static void run_shell(
+ size_t n_args = 1 + su->fast_startup + 2 * ! !command + n_additional_args + 1;
+ const char **args = xcalloc(n_args, sizeof *args);
+ size_t argno = 1;
++ char *tmp;
+
+ DBG(MISC, ul_debug("starting shell [shell=%s, command=\"%s\"%s%s]",
+ shell, command,
+ su->simulate_login ? " login" : "",
+ su->fast_startup ? " fast-start" : ""));
++ tmp = xstrdup(shell);
+
+- char* tmp = xstrdup(shell);
+ if (su->simulate_login) {
+ char *arg0;
+ char *shell_basename;
+@@ -851,10 +852,8 @@ static void run_shell(
+ arg0[0] = '-';
+ strcpy(arg0 + 1, shell_basename);
+ args[0] = arg0;
+- } else {
+- args[0] = basename(tmp);
+- }
+- free(tmp);
++ } else
++ args[0] = basename(tmp);
+
+ if (su->fast_startup)
+ args[argno++] = "-f";
diff --git a/sys-apps/util-linux/files/util-linux-2.39.3-libblkid-luks.patch b/sys-apps/util-linux/files/util-linux-2.39.3-libblkid-luks.patch
new file mode 100644
index 000000000000..222243426d5e
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.39.3-libblkid-luks.patch
@@ -0,0 +1,40 @@
+https://bugs.gentoo.org/926950
+https://gitlab.com/lvmteam/lvm2/-/issues/11
+https://bugzilla.opensuse.org/show_bug.cgi?id=1213227
+https://github.com/util-linux/util-linux/pull/2373
+https://github.com/util-linux/util-linux/commit/93ba7961779789217a1f814ce3110ff8c040c8c3
+
+From 93ba7961779789217a1f814ce3110ff8c040c8c3 Mon Sep 17 00:00:00 2001
+From: Fabian Vogt <fvogt@suse.de>
+Date: Wed, 12 Jul 2023 15:48:27 +0200
+Subject: [PATCH] Revert "libblkid: try LUKS2 first when probing"
+
+mdadm superblocks before 1.1 are placed at the end of the device, which
+means that the data contained inside the array starts at offset 0. For
+LUKS inside MD, blkid falsely detects this as plain LUKS instead of a
+linux_raid_member. This causes e.g. dracut to not assemble the array
+during boot and system startup fails.
+
+This reverts commit b8889c0a214aeb3dd47bf1ab280fe5534b64d2aa.
+--- a/libblkid/src/superblocks/superblocks.c
++++ b/libblkid/src/superblocks/superblocks.c
+@@ -94,11 +94,6 @@ static int blkid_probe_set_usage(blkid_probe pr, int usage);
+ */
+ static const struct blkid_idinfo *idinfos[] =
+ {
+- /* In case the volume is locked with OPAL we are going to get
+- * an I/O error when reading past the LUKS header, so try it
+- * first. */
+- &luks_idinfo,
+-
+ /* RAIDs */
+ &linuxraid_idinfo,
+ &ddfraid_idinfo,
+@@ -124,6 +119,7 @@ static const struct blkid_idinfo *idinfos[] =
+ &snapcow_idinfo,
+ &verity_hash_idinfo,
+ &integrity_idinfo,
++ &luks_idinfo,
+ &vmfs_volume_idinfo,
+ &ubi_idinfo,
+ &vdo_idinfo,
diff --git a/sys-apps/util-linux/files/util-linux-2.39.3-libmount-Fix-export-of-mnt_context_is_lazy-and-mnt_c.patch b/sys-apps/util-linux/files/util-linux-2.39.3-libmount-Fix-export-of-mnt_context_is_lazy-and-mnt_c.patch
new file mode 100644
index 000000000000..710ca934115f
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.39.3-libmount-Fix-export-of-mnt_context_is_lazy-and-mnt_c.patch
@@ -0,0 +1,55 @@
+https://bugs.gentoo.org/927258
+https://github.com/util-linux/util-linux/pull/2845
+
+From d271589d9536181184fcd19194f879e7c776d43e Mon Sep 17 00:00:00 2001
+From: Matt Turner <mattst88@gmail.com>
+Date: Mon, 18 Mar 2024 21:29:13 -0400
+Subject: [PATCH] libmount: Fix export of mnt_context_is_lazy and
+ mnt_context_is_onlyonce
+
+[kzak@redhat.com: - fix also function docs]
+
+Bug: https://bugs.gentoo.org/927258
+Closes: https://github.com/util-linux/util-linux/issues/2844
+Fixes: 3d1c41c8c ("libmount: add --onlyonce")
+Signed-off-by: Matt Turner <mattst88@gmail.com>
+Signed-off-by: Karel Zak <kzak@redhat.com>
+(cherry picked from commit 6d2917f2eb910fb8bcdc6476be18c34fee152911)
+---
+ libmount/src/context.c | 4 ++--
+ libmount/src/libmount.sym | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libmount/src/context.c b/libmount/src/context.c
+index 0cd320190..20f4c64ae 100644
+--- a/libmount/src/context.c
++++ b/libmount/src/context.c
+@@ -549,10 +549,10 @@ int mnt_context_enable_onlyonce(struct libmnt_context *cxt, int enable)
+ }
+
+ /**
+- * mnt_context_is_lazy:
++ * mnt_context_is_onlyonce:
+ * @cxt: mount context
+ *
+- * Returns: 1 if lazy umount is enabled or 0
++ * Returns: 1 if only-once mount is enabled or 0
+ */
+ int mnt_context_is_onlyonce(struct libmnt_context *cxt)
+ {
+diff --git a/libmount/src/libmount.sym b/libmount/src/libmount.sym
+index 715bb5c5f..1fa8bce3c 100644
+--- a/libmount/src/libmount.sym
++++ b/libmount/src/libmount.sym
+@@ -370,7 +370,7 @@ MOUNT_2_38 {
+ MOUNT_2_39 {
+ mnt_cache_set_sbprobe;
+ mnt_context_enable_onlyonce;
+- mnt_context_is_lazy;
++ mnt_context_is_onlyonce;
+ mnt_context_enable_noautofs;
+ mnt_table_enable_noautofs;
+ mnt_table_is_noautofs;
+--
+2.43.2
+
diff --git a/sys-apps/util-linux/files/util-linux-2.39.3-musl-1.2.5-basename.patch b/sys-apps/util-linux/files/util-linux-2.39.3-musl-1.2.5-basename.patch
new file mode 100644
index 000000000000..519545e17088
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.39.3-musl-1.2.5-basename.patch
@@ -0,0 +1,56 @@
+https://bugs.gentoo.org/926293
+https://github.com/util-linux/util-linux/commit/77454e58d58f904cfdc02d3ca5bb65f1bd8739fc
+
+From 77454e58d58f904cfdc02d3ca5bb65f1bd8739fc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 3 Dec 2023 19:59:46 -0800
+Subject: [PATCH] login-utils: include libgen.h for basename API
+
+musl has removed the non-prototype declaration of basename from string.h [1] which now results in build errors with clang-17+ compiler
+
+include libgen.h for using the posix declaration of the funciton.
+
+Fixes
+
+../util-linux-2.39.2/login-utils/su-common.c:847:20: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
+ 847 | shell_basename = basename(shell);
+ | ^
+
+[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+--- a/login-utils/su-common.c
++++ b/login-utils/su-common.c
+@@ -26,6 +26,7 @@
+ #include <sys/types.h>
+ #include <pwd.h>
+ #include <grp.h>
++#include <libgen.h>
+ #include <security/pam_appl.h>
+ #ifdef HAVE_SECURITY_PAM_MISC_H
+ # include <security/pam_misc.h>
+@@ -840,17 +841,20 @@ static void run_shell(
+ su->simulate_login ? " login" : "",
+ su->fast_startup ? " fast-start" : ""));
+
++ char* tmp = xstrdup(shell);
+ if (su->simulate_login) {
+ char *arg0;
+ char *shell_basename;
+
+- shell_basename = basename(shell);
++ shell_basename = basename(tmp);
+ arg0 = xmalloc(strlen(shell_basename) + 2);
+ arg0[0] = '-';
+ strcpy(arg0 + 1, shell_basename);
+ args[0] = arg0;
+- } else
+- args[0] = basename(shell);
++ } else {
++ args[0] = basename(tmp);
++ }
++ free(tmp);
+
+ if (su->fast_startup)
+ args[argno++] = "-f";
+
diff --git a/sys-apps/util-linux/files/util-linux-2.39.4-umount-readonly.patch b/sys-apps/util-linux/files/util-linux-2.39.4-umount-readonly.patch
new file mode 100644
index 000000000000..57c8903348af
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.39.4-umount-readonly.patch
@@ -0,0 +1,35 @@
+https://github.com/util-linux/util-linux/commit/9ba8eb5d89f0ebba8b3a542c041a5838e10a0d75
+https://bugs.gentoo.org/573760#c11
+
+From 9ba8eb5d89f0ebba8b3a542c041a5838e10a0d75 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Tue, 23 Apr 2024 10:29:37 +0200
+Subject: [PATCH] libmount: fix umount --read-only
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Reported-by: Krzysztof Olędzki <ole@ans.pl>
+Signed-off-by: Karel Zak <kzak@redhat.com>
+(cherry picked from commit a20e7e23a8565e01b1c84de6924d1fbbdb1cfccc)
+--- a/libmount/src/context_umount.c
++++ b/libmount/src/context_umount.c
+@@ -267,6 +267,9 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg
+ * So, let's use statfs() if possible (it's bad idea for --lazy/--force
+ * umounts as target is probably unreachable NFS, also for --detach-loop
+ * as this additionally needs to know the name of the loop device).
++ *
++ * For the "umount --read-only" command, we need to read the mountinfo
++ * to obtain the mount source.
+ */
+ if (mnt_context_is_restricted(cxt)
+ || *tgt != '/'
+@@ -275,6 +278,7 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg
+ || mnt_context_is_lazy(cxt)
+ || mnt_context_is_nocanonicalize(cxt)
+ || mnt_context_is_loopdel(cxt)
++ || mnt_context_is_rdonly_umount(cxt)
+ || mnt_safe_stat(tgt, &st) != 0 || !S_ISDIR(st.st_mode)
+ || has_utab_entry(cxt, tgt))
+ return 1; /* not found */
+
diff --git a/sys-apps/util-linux/files/uuidd.initd b/sys-apps/util-linux/files/uuidd.initd
new file mode 100644
index 000000000000..3ddedc3f3b7f
--- /dev/null
+++ b/sys-apps/util-linux/files/uuidd.initd
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+command=/usr/sbin/uuidd
+command_args_foreground="-FP"
+command_user=uuidd
+pidfile=/run/uuidd/uuidd.pid
+
+depend() {
+ need clock localmount
+}
+
+start_pre() {
+ checkpath -d -m 2755 -o uuidd:uuidd /run/uuidd &&
+ checkpath -d -m 0755 -o uuidd:uuidd /var/lib/libuuid
+}