diff --git a/Add-check-to-resolve-uname26-version-test-failed.patch b/Add-check-to-resolve-uname26-version-test-failed.patch deleted file mode 100644 index 193c6ed..0000000 --- a/Add-check-to-resolve-uname26-version-test-failed.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 72466ac801928c205604b99fe01f830809bda930 Mon Sep 17 00:00:00 2001 -From: Liquor -Date: Thu, 17 Dec 2020 15:04:56 +0800 -Subject: [PATCH] Add check to resolve uname26-version test failed - -The uname command is modified in packages uname-build-checks, -but the uname26-version test case needs to use the uname -r query -result.As a result,the test fails. -So we add a judgment to check whether uname-build-checks is installed. ---- - tests/ts/misc/setarch | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/tests/ts/misc/setarch b/tests/ts/misc/setarch -index 7c99cca..25d02c1 100755 ---- a/tests/ts/misc/setarch -+++ b/tests/ts/misc/setarch -@@ -77,7 +77,12 @@ ts_finalize_subtest "$finmsg" - # conditional subtest - if [ "$uname26_seems_supported" = "yes" ]; then - ts_init_subtest uname26-version -- tmp=$($TS_CMD_SETARCH $ARCH --uname-2.6 uname -r) -+ rpm -qa | grep -q "uname-build-checks" -+ if [ $? -eq 0 ]; then -+ tmp=$($TS_CMD_SETARCH $ARCH --uname-2.6 uname.bin -r) -+ else -+ tmp=$($TS_CMD_SETARCH $ARCH --uname-2.6 uname -r) -+ fi - if echo "$tmp" | grep -q "^2\.6\."; then - echo "kernel version changed to 2.6" >> $TS_OUTPUT - else --- -2.27.0 - diff --git a/SKIPPED-no-root-permissions-test.patch b/SKIPPED-no-root-permissions-test.patch index f8b7526..0f9ddfb 100644 --- a/SKIPPED-no-root-permissions-test.patch +++ b/SKIPPED-no-root-permissions-test.patch @@ -8,11 +8,11 @@ Subject: [PATCH] unshare: SKIPPED (no root permissions) 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ts/lsns/ioctl_ns b/tests/ts/lsns/ioctl_ns -index ef63606..a979893 100755 +index 6f306d5..9d436c7 100755 --- a/tests/ts/lsns/ioctl_ns +++ b/tests/ts/lsns/ioctl_ns @@ -21,7 +21,7 @@ TS_DESC="ownership and hierarchy" - . $TS_TOPDIR/functions.sh + . "$TS_TOPDIR"/functions.sh ts_init "$*" -# ts_skip_nonroot @@ -21,5 +21,5 @@ index ef63606..a979893 100755 [ -r /proc/self/ns/user ] || ts_skip "no USER namespace kernel support" -- -2.27.0 +2.33.0 diff --git a/backport-CVE-2021-3995.patch b/backport-CVE-2021-3995.patch deleted file mode 100644 index cd58532..0000000 --- a/backport-CVE-2021-3995.patch +++ /dev/null @@ -1,138 +0,0 @@ -From f3db9bd609494099f0c1b95231c5dfe383346929 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 24 Nov 2021 13:53:25 +0100 -Subject: [PATCH] libmount: fix UID check for FUSE umount [CVE-2021-3995] - -Improper UID check allows an unprivileged user to unmount FUSE -filesystems of users with similar UID. - -Signed-off-by: Karel Zak -Reference:https://github.com/util-linux/util-linux/commit/f3db9bd609494099f0c1b95231c5dfe383346929 -Conflict:NA ---- - include/strutils.h | 2 +- - libmount/src/context_umount.c | 13 +++-------- - libmount/src/mountP.h | 1 + - libmount/src/optstr.c | 42 +++++++++++++++++++++++++++++++++++ - 4 files changed, 47 insertions(+), 11 deletions(-) - -diff --git a/include/strutils.h b/include/strutils.h -index 4b3182f..50e493a 100644 ---- a/include/strutils.h -+++ b/include/strutils.h -@@ -88,8 +88,8 @@ static inline char *mem2strcpy(char *dest, const void *src, size_t n, size_t nma - if (n + 1 > nmax) - n = nmax - 1; - -+ memset(dest, '\0', nmax); - memcpy(dest, src, n); -- dest[nmax-1] = '\0'; - return dest; - } - -diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c -index 94f824b..0d77fff 100644 ---- a/libmount/src/context_umount.c -+++ b/libmount/src/context_umount.c -@@ -393,10 +393,7 @@ static int is_fuse_usermount(struct libmnt_context *cxt, int *errsv) - struct libmnt_ns *ns_old; - const char *type = mnt_fs_get_fstype(cxt->fs); - const char *optstr; -- char *user_id = NULL; -- size_t sz; -- uid_t uid; -- char uidstr[sizeof(stringify_value(ULONG_MAX))]; -+ uid_t uid, entry_uid; - - *errsv = 0; - -@@ -414,10 +411,7 @@ static int is_fuse_usermount(struct libmnt_context *cxt, int *errsv) - if (!optstr) - return 0; - -- if (mnt_optstr_get_option(optstr, "user_id", &user_id, &sz) != 0) -- return 0; -- -- if (sz == 0 || user_id == NULL) -+ if (mnt_optstr_get_uid(optstr, "user_id", &entry_uid) != 0) - return 0; - - /* get current user */ -@@ -434,8 +428,7 @@ static int is_fuse_usermount(struct libmnt_context *cxt, int *errsv) - return 0; - } - -- snprintf(uidstr, sizeof(uidstr), "%lu", (unsigned long) uid); -- return strncmp(user_id, uidstr, sz) == 0; -+ return uid == entry_uid; - } - - /* -diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h -index d8ba0ab..4a2ddb3 100644 ---- a/libmount/src/mountP.h -+++ b/libmount/src/mountP.h -@@ -401,6 +401,7 @@ extern const struct libmnt_optmap *mnt_optmap_get_entry( - const struct libmnt_optmap **mapent); - - /* optstr.c */ -+extern int mnt_optstr_get_uid(const char *optstr, const char *name, uid_t *uid); - extern int mnt_optstr_remove_option_at(char **optstr, char *begin, char *end); - extern int mnt_optstr_fix_gid(char **optstr, char *value, size_t valsz, char **next); - extern int mnt_optstr_fix_uid(char **optstr, char *value, size_t valsz, char **next); -diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c -index eea952b..8a92c32 100644 ---- a/libmount/src/optstr.c -+++ b/libmount/src/optstr.c -@@ -1090,6 +1090,48 @@ int mnt_optstr_fix_user(char **optstr) - return rc; - } - -+/* -+ * Converts value from @optstr addressed by @name to uid. -+ * -+ * Returns: 0 on success, 1 if not found, <0 on error -+ */ -+int mnt_optstr_get_uid(const char *optstr, const char *name, uid_t *uid) -+{ -+ char *value = NULL; -+ size_t valsz = 0; -+ char buf[sizeof(stringify_value(UINT64_MAX))]; -+ int rc; -+ uint64_t num; -+ -+ assert(optstr); -+ assert(name); -+ assert(uid); -+ -+ rc = mnt_optstr_get_option(optstr, name, &value, &valsz); -+ if (rc != 0) -+ goto fail; -+ -+ if (valsz > sizeof(buf) - 1) { -+ rc = -ERANGE; -+ goto fail; -+ } -+ mem2strcpy(buf, value, valsz, sizeof(buf)); -+ -+ rc = ul_strtou64(buf, &num, 10); -+ if (rc != 0) -+ goto fail; -+ if (num > ULONG_MAX || (uid_t) num != num) { -+ rc = -ERANGE; -+ goto fail; -+ } -+ *uid = (uid_t) num; -+ -+ return 0; -+fail: -+ DBG(UTILS, ul_debug("failed to convert '%s'= to number [rc=%d]", name, rc)); -+ return rc; -+} -+ - /** - * mnt_match_options: - * @optstr: options string --- -2.27.0 - diff --git a/backport-CVE-2021-3996.patch b/backport-CVE-2021-3996.patch deleted file mode 100644 index 12b81e2..0000000 --- a/backport-CVE-2021-3996.patch +++ /dev/null @@ -1,226 +0,0 @@ -From 018a10907fa9885093f6d87401556932c2d8bd2b Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 4 Jan 2022 10:54:20 +0100 -Subject: [PATCH] libmount: fix (deleted) suffix issue [CVE-2021-3996] - -This issue is related to parsing the /proc/self/mountinfo file allows an -unprivileged user to unmount other user's filesystems that are either -world-writable themselves or mounted in a world-writable directory. - -The support for "(deleted)" is no more necessary as the Linux kernel does -not use it in /proc/self/mountinfo and /proc/self/mount files anymore. - -Signed-off-by: Karel Zak -Reference:https://github.com/util-linux/util-linux/commit/018a10907fa9885093f6d87401556932c2d8bd2b -Conflict:NA ---- - libmount/src/tab_parse.c | 5 ----- - tests/expected/findmnt/filter-options | 1 - - tests/expected/findmnt/filter-options-nameval-neg | 3 +-- - tests/expected/findmnt/filter-types-neg | 1 - - tests/expected/findmnt/outputs-default | 3 +-- - tests/expected/findmnt/outputs-force-tree | 3 +-- - tests/expected/findmnt/outputs-kernel | 3 +-- - tests/expected/libmount/tabdiff-mount | 1 - - tests/expected/libmount/tabdiff-move | 1 - - tests/expected/libmount/tabdiff-remount | 1 - - tests/expected/libmount/tabdiff-umount | 1 - - tests/expected/libmount/tabfiles-parse-mountinfo | 11 ----------- - tests/expected/libmount/tabfiles-py-parse-mountinfo | 11 ----------- - tests/ts/findmnt/files/mountinfo | 1 - - tests/ts/findmnt/files/mountinfo-nonroot | 1 - - tests/ts/libmount/files/mountinfo | 1 - - 16 files changed, 4 insertions(+), 44 deletions(-) - -diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c -index 3a2cc0d..eec9758 100644 ---- a/libmount/src/tab_parse.c -+++ b/libmount/src/tab_parse.c -@@ -225,11 +225,6 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, const char *s) - goto fail; - } - -- /* remove "\040(deleted)" suffix */ -- p = (char *) endswith(fs->target, PATH_DELETED_SUFFIX); -- if (p && *p) -- *p = '\0'; -- - s = skip_separator(s); - - /* (6) vfs options (fs-independent) */ -diff --git a/tests/expected/findmnt/filter-options b/tests/expected/findmnt/filter-options -index 2606bce..97b0ead 100644 ---- a/tests/expected/findmnt/filter-options -+++ b/tests/expected/findmnt/filter-options -@@ -28,5 +28,4 @@ TARGET SOURCE FSTYPE OPTIONS - /home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 - /var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime - /mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 --/mnt/foo /fooooo bar rw,relatime - rc=0 -diff --git a/tests/expected/findmnt/filter-options-nameval-neg b/tests/expected/findmnt/filter-options-nameval-neg -index 5471d65..f0467ef 100644 ---- a/tests/expected/findmnt/filter-options-nameval-neg -+++ b/tests/expected/findmnt/filter-options-nameval-neg -@@ -29,6 +29,5 @@ TARGET SOURCE FSTYPE OPTIO - |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered - | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 - |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime --|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 --`-/mnt/foo /fooooo bar rw,relatime -+`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 - rc=0 -diff --git a/tests/expected/findmnt/filter-types-neg b/tests/expected/findmnt/filter-types-neg -index 2606bce..97b0ead 100644 ---- a/tests/expected/findmnt/filter-types-neg -+++ b/tests/expected/findmnt/filter-types-neg -@@ -28,5 +28,4 @@ TARGET SOURCE FSTYPE OPTIONS - /home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 - /var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime - /mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 --/mnt/foo /fooooo bar rw,relatime - rc=0 -diff --git a/tests/expected/findmnt/outputs-default b/tests/expected/findmnt/outputs-default -index 5949579..0159935 100644 ---- a/tests/expected/findmnt/outputs-default -+++ b/tests/expected/findmnt/outputs-default -@@ -30,6 +30,5 @@ TARGET SOURCE FSTYPE OPTIO - |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered - | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 - |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime --|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 --`-/mnt/foo /fooooo bar rw,relatime -+`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 - rc=0 -diff --git a/tests/expected/findmnt/outputs-force-tree b/tests/expected/findmnt/outputs-force-tree -index 5949579..0159935 100644 ---- a/tests/expected/findmnt/outputs-force-tree -+++ b/tests/expected/findmnt/outputs-force-tree -@@ -30,6 +30,5 @@ TARGET SOURCE FSTYPE OPTIO - |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered - | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 - |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime --|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 --`-/mnt/foo /fooooo bar rw,relatime -+`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 - rc=0 -diff --git a/tests/expected/findmnt/outputs-kernel b/tests/expected/findmnt/outputs-kernel -index 5949579..0159935 100644 ---- a/tests/expected/findmnt/outputs-kernel -+++ b/tests/expected/findmnt/outputs-kernel -@@ -30,6 +30,5 @@ TARGET SOURCE FSTYPE OPTIO - |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered - | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 - |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime --|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 --`-/mnt/foo /fooooo bar rw,relatime -+`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 - rc=0 -diff --git a/tests/expected/libmount/tabdiff-mount b/tests/expected/libmount/tabdiff-mount -index 420aeac..3c18f8d 100644 ---- a/tests/expected/libmount/tabdiff-mount -+++ b/tests/expected/libmount/tabdiff-mount -@@ -1,3 +1,2 @@ - /dev/mapper/kzak-home on /home/kzak: MOUNTED --/fooooo on /mnt/foo: MOUNTED - tmpfs on /mnt/test/foo bar: MOUNTED -diff --git a/tests/expected/libmount/tabdiff-move b/tests/expected/libmount/tabdiff-move -index 24f9bc7..95820d9 100644 ---- a/tests/expected/libmount/tabdiff-move -+++ b/tests/expected/libmount/tabdiff-move -@@ -1,3 +1,2 @@ - //foo.home/bar/ on /mnt/music: MOVED to /mnt/music --/fooooo on /mnt/foo: UMOUNTED - tmpfs on /mnt/test/foo bar: UMOUNTED -diff --git a/tests/expected/libmount/tabdiff-remount b/tests/expected/libmount/tabdiff-remount -index 82ebeab..876bfd9 100644 ---- a/tests/expected/libmount/tabdiff-remount -+++ b/tests/expected/libmount/tabdiff-remount -@@ -1,4 +1,3 @@ - /dev/mapper/kzak-home on /home/kzak: REMOUNTED from 'rw,noatime,barrier=1,data=ordered' to 'ro,noatime,barrier=1,data=ordered' - //foo.home/bar/ on /mnt/sounds: REMOUNTED from 'rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344' to 'ro,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344' --/fooooo on /mnt/foo: UMOUNTED - tmpfs on /mnt/test/foo bar: UMOUNTED -diff --git a/tests/expected/libmount/tabdiff-umount b/tests/expected/libmount/tabdiff-umount -index a3e0fe4..c7be725 100644 ---- a/tests/expected/libmount/tabdiff-umount -+++ b/tests/expected/libmount/tabdiff-umount -@@ -1,3 +1,2 @@ - /dev/mapper/kzak-home on /home/kzak: UMOUNTED --/fooooo on /mnt/foo: UMOUNTED - tmpfs on /mnt/test/foo bar: UMOUNTED -diff --git a/tests/expected/libmount/tabfiles-parse-mountinfo b/tests/expected/libmount/tabfiles-parse-mountinfo -index 47eb770..d5ba524 100644 ---- a/tests/expected/libmount/tabfiles-parse-mountinfo -+++ b/tests/expected/libmount/tabfiles-parse-mountinfo -@@ -351,17 +351,6 @@ id: 47 - parent: 20 - devno: 0:38 - ------ fs: --source: /fooooo --target: /mnt/foo --fstype: bar --optstr: rw,relatime --VFS-optstr: rw,relatime --FS-opstr: rw --root: / --id: 48 --parent: 20 --devno: 0:39 -------- fs: - source: tmpfs - target: /mnt/test/foo bar - fstype: tmpfs -diff --git a/tests/expected/libmount/tabfiles-py-parse-mountinfo b/tests/expected/libmount/tabfiles-py-parse-mountinfo -index 47eb770..d5ba524 100644 ---- a/tests/expected/libmount/tabfiles-py-parse-mountinfo -+++ b/tests/expected/libmount/tabfiles-py-parse-mountinfo -@@ -351,17 +351,6 @@ id: 47 - parent: 20 - devno: 0:38 - ------ fs: --source: /fooooo --target: /mnt/foo --fstype: bar --optstr: rw,relatime --VFS-optstr: rw,relatime --FS-opstr: rw --root: / --id: 48 --parent: 20 --devno: 0:39 -------- fs: - source: tmpfs - target: /mnt/test/foo bar - fstype: tmpfs -diff --git a/tests/ts/findmnt/files/mountinfo b/tests/ts/findmnt/files/mountinfo -index 475ea1a..ff1e664 100644 ---- a/tests/ts/findmnt/files/mountinfo -+++ b/tests/ts/findmnt/files/mountinfo -@@ -30,4 +30,3 @@ - 44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500 - 45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw - 47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 --48 20 0:39 / /mnt/foo\040(deleted) rw,relatime - bar /fooooo rw -diff --git a/tests/ts/findmnt/files/mountinfo-nonroot b/tests/ts/findmnt/files/mountinfo-nonroot -index e15b467..87b421d 100644 ---- a/tests/ts/findmnt/files/mountinfo-nonroot -+++ b/tests/ts/findmnt/files/mountinfo-nonroot -@@ -29,4 +29,3 @@ - 44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500 - 45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw - 47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 --48 20 0:39 / /mnt/foo\040(deleted) rw,relatime - bar /fooooo rw -diff --git a/tests/ts/libmount/files/mountinfo b/tests/ts/libmount/files/mountinfo -index c063071..2b01740 100644 ---- a/tests/ts/libmount/files/mountinfo -+++ b/tests/ts/libmount/files/mountinfo -@@ -30,5 +30,4 @@ - 44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500 - 45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw - 47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 --48 20 0:39 / /mnt/foo\040(deleted) rw,relatime - bar /fooooo rw - 49 20 0:56 / /mnt/test/foo bar rw,relatime shared:323 - tmpfs tmpfs rw --- -2.27.0 - diff --git a/backport-CVE-2022-0563.patch b/backport-CVE-2022-0563.patch deleted file mode 100644 index 63143f6..0000000 --- a/backport-CVE-2022-0563.patch +++ /dev/null @@ -1,169 +0,0 @@ -From faa5a3a83ad0cb5e2c303edbfd8cd823c9d94c17 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 10 Feb 2022 12:03:17 +0100 -Subject: [PATCH] chsh, chfn: remove readline support [CVE-2022-0563] - -The readline library uses INPUTRC= environment variable to get a path -to the library config file. When the library cannot parse the -specified file, it prints an error message containing data from the -file. - -Unfortunately, the library does not use secure_getenv() (or a similar -concept) to avoid vulnerabilities that could occur if set-user-ID or -set-group-ID programs. - -Reported-by: Rory Mackie -Signed-off-by: Karel Zak - ---- - login-utils/Makemodule.am | 2 +- - login-utils/chfn.c | 16 ++++---------- - login-utils/chsh.c | 45 ++++----------------------------------- - 3 files changed, 9 insertions(+), 54 deletions(-) - -diff --git a/login-utils/Makemodule.am b/login-utils/Makemodule.am -index 75c0a67..2d0547a 100644 ---- a/login-utils/Makemodule.am -+++ b/login-utils/Makemodule.am -@@ -109,7 +109,7 @@ chfn_chsh_sources = \ - login-utils/ch-common.c - chfn_chsh_cflags = $(SUID_CFLAGS) $(AM_CFLAGS) - chfn_chsh_ldflags = $(SUID_LDFLAGS) $(AM_LDFLAGS) --chfn_chsh_ldadd = libcommon.la $(READLINE_LIBS) -+chfn_chsh_ldadd = libcommon.la - - if CHFN_CHSH_PASSWORD - chfn_chsh_ldadd += -lpam -diff --git a/login-utils/chfn.c b/login-utils/chfn.c -index ece5cdc..8f00d15 100644 ---- a/login-utils/chfn.c -+++ b/login-utils/chfn.c -@@ -56,11 +56,6 @@ - # include "auth.h" - #endif - --#ifdef HAVE_LIBREADLINE --# define _FUNCTION_DEF --# include --#endif -- - struct finfo { - char *full_name; - char *office; -@@ -228,24 +223,21 @@ static char *ask_new_field(struct chfn_control *ctl, const char *question, - { - int len; - char *buf = NULL; /* leave initialized to NULL or getline segfaults */ --#ifndef HAVE_LIBREADLINE - size_t dummy = 0; --#endif - - if (!def_val) - def_val = ""; -+ - while (true) { - printf("%s [%s]:", question, def_val); - __fpurge(stdin); --#ifdef HAVE_LIBREADLINE -- rl_bind_key('\t', rl_insert); -- if ((buf = readline(" ")) == NULL) --#else -+ - putchar(' '); - fflush(stdout); -+ - if (getline(&buf, &dummy, stdin) < 0) --#endif - errx(EXIT_FAILURE, _("Aborted.")); -+ - /* remove white spaces from string end */ - ltrim_whitespace((unsigned char *) buf); - len = rtrim_whitespace((unsigned char *) buf); -diff --git a/login-utils/chsh.c b/login-utils/chsh.c -index 3b446be..b7e7017 100644 ---- a/login-utils/chsh.c -+++ b/login-utils/chsh.c -@@ -50,7 +50,6 @@ - # include "selinux-utils.h" - #endif - -- - #ifdef HAVE_LIBUSER - # include - # include "libuser.h" -@@ -58,11 +57,6 @@ - # include "auth.h" - #endif - --#ifdef HAVE_LIBREADLINE --# define _FUNCTION_DEF --# include --#endif -- - struct sinfo { - char *username; - char *shell; -@@ -121,33 +115,6 @@ static void print_shells(void) - endusershell(); - } - --#ifdef HAVE_LIBREADLINE --static char *shell_name_generator(const char *text, int state) --{ -- static size_t len; -- char *s; -- -- if (!state) { -- setusershell(); -- len = strlen(text); -- } -- -- while ((s = getusershell())) { -- if (strncmp(s, text, len) == 0) -- return xstrdup(s); -- } -- return NULL; --} -- --static char **shell_name_completion(const char *text, -- int start __attribute__((__unused__)), -- int end __attribute__((__unused__))) --{ -- rl_attempted_completion_over = 1; -- return rl_completion_matches(text, shell_name_generator); --} --#endif -- - /* - * parse_argv () -- - * parse the command line arguments, and fill in "pinfo" with any -@@ -198,22 +165,18 @@ static char *ask_new_shell(char *question, char *oldshell) - { - int len; - char *ans = NULL; --#ifdef HAVE_LIBREADLINE -- rl_attempted_completion_function = shell_name_completion; --#else - size_t dummy = 0; --#endif -+ - if (!oldshell) - oldshell = ""; - printf("%s [%s]:", question, oldshell); --#ifdef HAVE_LIBREADLINE -- if ((ans = readline(" ")) == NULL) --#else -+ - putchar(' '); - fflush(stdout); -+ - if (getline(&ans, &dummy, stdin) < 0) --#endif - return NULL; -+ - /* remove the newline at the end of ans. */ - ltrim_whitespace((unsigned char *) ans); - len = rtrim_whitespace((unsigned char *) ans); --- -2.27.0 - diff --git a/backport-Fix-integer-overflow-for-alpha-like-linux.patch b/backport-Fix-integer-overflow-for-alpha-like-linux.patch deleted file mode 100644 index d2c76b7..0000000 --- a/backport-Fix-integer-overflow-for-alpha-like-linux.patch +++ /dev/null @@ -1,22 +0,0 @@ -From db5aa5e5d8932c73f1b9f01fe567fa343898b825 Mon Sep 17 00:00:00 2001 -From: chanthmiao -Date: Sun, 5 Dec 2021 16:58:17 +0800 -Subject: [PATCH] Fix integer overflow for alpha like linux - ---- - sys-utils/swapon.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c -index ed6be244ec..76c5cac51b 100644 ---- a/sys-utils/swapon.c -+++ b/sys-utils/swapon.c -@@ -543,7 +543,7 @@ static int swapon_checks(const struct swapon_ctl *ctl, struct swap_device *dev) - - /* test for holes by LBT */ - if (S_ISREG(st.st_mode)) { -- if (st.st_blocks * 512 < st.st_size) { -+ if (st.st_blocks * 512L < st.st_size) { - warnx(_("%s: skipping - it appears to have holes."), - dev->path); - goto err; diff --git a/backport-Fix-memory-leaks-in-the-chcpu.patch b/backport-Fix-memory-leaks-in-the-chcpu.patch deleted file mode 100644 index 2607013..0000000 --- a/backport-Fix-memory-leaks-in-the-chcpu.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 8757959ac2b64aa30cb748822c858c0c2d0410dd Mon Sep 17 00:00:00 2001 -From: jiazhenyuan -Date: Mon, 6 Sep 2021 16:50:27 +0800 -Subject: [PATCH] Fix memory leaks in the chcpu - ---- - sys-utils/chcpu.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c -index c4e5bc7..527bce5 100644 ---- a/sys-utils/chcpu.c -+++ b/sys-utils/chcpu.c -@@ -383,6 +383,7 @@ int main(int argc, char *argv[]) - break; - } - -+ CPU_FREE(cpu_set); - ul_unref_path(sys); - - return rc == 0 ? EXIT_SUCCESS : --- -1.8.3.1 - diff --git a/backport-Forward-value-of-sector_size-instead-of-its-address.patch b/backport-Forward-value-of-sector_size-instead-of-its-address.patch deleted file mode 100644 index 2b8fee1..0000000 --- a/backport-Forward-value-of-sector_size-instead-of-its-address.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 9b1d5d040d82db567c9ab0ea2b271b6d12e8969f Mon Sep 17 00:00:00 2001 -From: Nicolas Melot -Date: Sun, 1 Aug 2021 19:20:58 +0200 -Subject: [PATCH] Forward value of sector_size instead of its address in - blkdev_get_physector_size - ---- - lib/blkdev.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/lib/blkdev.c b/lib/blkdev.c -index c22853d..2d02fb8 100644 ---- a/lib/blkdev.c -+++ b/lib/blkdev.c -@@ -222,8 +222,10 @@ int blkdev_get_sector_size(int fd __attribute__((__unused__)), int *sector_size) - #ifdef BLKPBSZGET - int blkdev_get_physector_size(int fd, int *sector_size) - { -- if (ioctl(fd, BLKPBSZGET, §or_size) >= 0) -+ if (ioctl(fd, BLKPBSZGET, sector_size) >= 0) -+ { - return 0; -+ } - return -1; - } - #else --- -1.8.3.1 - diff --git a/backport-Maybe-there-is-a-little-mistake-in-do_taskset-functi.patch b/backport-Maybe-there-is-a-little-mistake-in-do_taskset-functi.patch deleted file mode 100644 index 4d974e7..0000000 --- a/backport-Maybe-there-is-a-little-mistake-in-do_taskset-functi.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 6ff67988785af818b97a7175c8ca80f2ee2d039f Mon Sep 17 00:00:00 2001 -From: csbo98 -Date: Sun, 22 May 2022 14:47:13 +0800 -Subject: [PATCH] Maybe there is a little mistake in do_taskset() function in - taskset.c. In the first call of sched_getaffinity(), if the call is failed we - should use err_affinity(ts->pid, 0) other than err_affinity(ts->pid, 1). ---- - schedutils/taskset.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/schedutils/taskset.c b/schedutils/taskset.c -index 224cfbe23..0ab7d12e2 100644 ---- a/schedutils/taskset.c -+++ b/schedutils/taskset.c -@@ -117,7 +117,7 @@ static void do_taskset(struct taskset *ts, size_t setsize, cpu_set_t *set) - /* read the current mask */ - if (ts->pid) { - if (sched_getaffinity(ts->pid, ts->setsize, ts->set) < 0) -- err_affinity(ts->pid, 1); -+ err_affinity(ts->pid, 0); - print_affinity(ts, FALSE); - } - --- -2.33.0 - diff --git a/backport-add-return-in-supam_conv-function.patch b/backport-add-return-in-supam_conv-function.patch deleted file mode 100644 index 21fc7da..0000000 --- a/backport-add-return-in-supam_conv-function.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 1ade162b7773ffd3a1c83ad9f4ce529ac69d619c Mon Sep 17 00:00:00 2001 -From: Stefan Radu -Date: Tue, 25 Apr 2023 15:00:36 +0300 -Subject: [PATCH] add return in supam_conv function - -Added return statement to ensure that all execution paths end with a -return statement. - -Signed-off-by: Stefan Radu ---- - login-utils/su-common.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/login-utils/su-common.c b/login-utils/su-common.c -index 4b284995e..67c4fa271 100644 ---- a/login-utils/su-common.c -+++ b/login-utils/su-common.c -@@ -344,6 +344,7 @@ static int supam_conv( int num_msg, - #elif defined(HAVE_SECURITY_OPENPAM_H) - return openpam_ttyconv(num_msg, msg, resp, data); - #endif -+ return PAM_CONV_ERR; - } - - static void supam_cleanup(struct su_context *su, int retcode) --- -2.27.0 - diff --git a/backport-column-don-t-require-column-name-for-JSON.patch b/backport-column-don-t-require-column-name-for-JSON.patch deleted file mode 100644 index 4a1a62f..0000000 --- a/backport-column-don-t-require-column-name-for-JSON.patch +++ /dev/null @@ -1,103 +0,0 @@ -From fd75b96898c455c35c045bc59a2a4a546e79f223 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 23 Mar 2022 12:50:07 +0100 -Subject: [PATCH] column: don't require column name for JSON - -The "--table-hide -" hides all unnamed columns, but this does not work -for JSON output. This patch fixes this issue. - -Signed-off-by: Karel Zak ---- - text-utils/column.c | 37 +++++++++++++++++++++++++++++++++---- - 1 file changed, 33 insertions(+), 4 deletions(-) - -diff --git a/text-utils/column.c b/text-utils/column.c -index f9878e4..0fc4708 100644 ---- a/text-utils/column.c -+++ b/text-utils/column.c -@@ -96,6 +96,7 @@ struct column_control { - unsigned int greedy :1, - json :1, - header_repeat :1, -+ hide_unnamed :1, - keep_empty_lines :1, /* --keep-empty-lines */ - tab_noheadings :1; - }; -@@ -196,7 +197,10 @@ static char **split_or_error(const char *str, const char *errmsg) - if (!res) { - if (errno == ENOMEM) - err_oom(); -- errx(EXIT_FAILURE, "%s: '%s'", errmsg, str); -+ if (errmsg) -+ errx(EXIT_FAILURE, "%s: '%s'", errmsg, str); -+ else -+ return NULL; - } - return res; - } -@@ -275,6 +279,29 @@ static int column_set_flag(struct libscols_column *cl, int fl) - return scols_column_set_flags(cl, cur | fl); - } - -+static int has_unnamed(const char *list) -+{ -+ char **all, **one; -+ -+ if (!list) -+ return 0; -+ if (strcmp(list, "-") == 0) -+ return 1; -+ if (!strchr(list, ',')) -+ return 0; -+ -+ all = split_or_error(list, NULL); -+ if (all) { -+ STRV_FOREACH(one, all) { -+ if (strcmp(*one, "-") == 0) -+ return 1; -+ } -+ strv_free(all); -+ } -+ -+ return 0; -+} -+ - static void apply_columnflag_from_list(struct column_control *ctl, const char *list, - int flag, const char *errmsg) - { -@@ -300,7 +327,7 @@ static void apply_columnflag_from_list(struct column_control *ctl, const char *l - - /* apply to columns specified by name */ - STRV_FOREACH(one, all) { -- if (flag == SCOLS_FL_HIDDEN && strcmp(*one, "-") == 0) { -+ if (strcmp(*one, "-") == 0) { - unnamed = 1; - continue; - } -@@ -461,12 +488,13 @@ static int add_line_to_table(struct column_control *ctl, wchar_t *wcs0) - if (!wcdata) - break; - if (scols_table_get_ncols(ctl->tab) < n + 1) { -- if (scols_table_is_json(ctl->tab)) -+ if (scols_table_is_json(ctl->tab) && !ctl->hide_unnamed) - errx(EXIT_FAILURE, _("line %zu: for JSON the name of the " - "column %zu is required"), - scols_table_get_nlines(ctl->tab) + 1, - n + 1); -- scols_table_new_column(ctl->tab, NULL, 0, 0); -+ scols_table_new_column(ctl->tab, NULL, 0, -+ ctl->hide_unnamed ? SCOLS_FL_HIDDEN : 0); - } - if (!ln) { - ln = scols_table_new_line(ctl->tab, NULL); -@@ -774,6 +802,7 @@ int main(int argc, char **argv) - break; - case 'H': - ctl.tab_colhide = optarg; -+ ctl.hide_unnamed = has_unnamed(ctl.tab_colhide); - break; - case 'i': - ctl.tree_id = optarg; --- -2.27.0 - diff --git a/backport-dmesg-fix-since-and-until.patch b/backport-dmesg-fix-since-and-until.patch deleted file mode 100644 index d5fbca3..0000000 --- a/backport-dmesg-fix-since-and-until.patch +++ /dev/null @@ -1,30 +0,0 @@ -From c9667633f1f6b7a84116f2af067d1d15c72e6382 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 20 Apr 2022 14:42:32 +0200 -Subject: [PATCH] dmesg: fix --since and --until - -Now --since and --until requires any time field in the output (e.g. ---ctime,-T), it means "dmesg --since '1 day ago'" doesn't work, but -"dmesg -T --since '1 day ago'" works as expected. - -Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2076829 -Signed-off-by: Karel Zak ---- - sys-utils/dmesg.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c -index 7cca88f2bb..017936255f 100644 ---- a/sys-utils/dmesg.c -+++ b/sys-utils/dmesg.c -@@ -1592,7 +1592,9 @@ int main(int argc, char *argv[]) - - if ((is_timefmt(&ctl, RELTIME) || - is_timefmt(&ctl, CTIME) || -- is_timefmt(&ctl, ISO8601))) { -+ is_timefmt(&ctl, ISO8601)) || -+ ctl.since || -+ ctl.until) { - if (dmesg_get_boot_time(&ctl.boot_time) != 0) - ctl.time_fmt = DMESG_TIMEFTM_NONE; - else diff --git a/backport-fdisk-fix-output-option-parsing.patch b/backport-fdisk-fix-output-option-parsing.patch deleted file mode 100644 index ba38c59..0000000 --- a/backport-fdisk-fix-output-option-parsing.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 55ef593842d94d657c8209042491c7590ea3bdf0 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 24 Oct 2022 09:57:07 +0200 -Subject: [PATCH] fdisk: fix --output option parsing - -Fixes: https://github.com/util-linux/util-linux/issues/1859 -Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1022249 -Signed-off-by: Karel Zak ---- - disk-utils/fdisk.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c -index 2bd2ef41b..79b904f25 100644 ---- a/disk-utils/fdisk.c -+++ b/disk-utils/fdisk.c -@@ -928,7 +928,7 @@ int main(int argc, char **argv) - { "type", required_argument, NULL, 't' }, - { "units", optional_argument, NULL, 'u' }, - { "version", no_argument, NULL, 'V' }, -- { "output", no_argument, NULL, 'o' }, -+ { "output", required_argument, NULL, 'o' }, - { "protect-boot", no_argument, NULL, 'B' }, - { "wipe", required_argument, NULL, 'w' }, - { "wipe-partitions",required_argument, NULL, 'W' }, --- -2.27.0 - diff --git a/backport-fflush-stdout-before-reading-from-stdin.patch b/backport-fflush-stdout-before-reading-from-stdin.patch deleted file mode 100644 index a0edc46..0000000 --- a/backport-fflush-stdout-before-reading-from-stdin.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0a08200bd5664d1849e477f7f776ab4d13bb8422 Mon Sep 17 00:00:00 2001 -From: Lorenzo Beretta -Date: Mon, 25 Oct 2021 15:28:02 +0200 -Subject: [PATCH] chsh: fflush stdout before reading from stdin - -Same problem as described in https://github.com/karelzak/util-linux/pull/1481 - -Signed-off-by: Lorenzo Beretta - ---- - login-utils/chsh.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/login-utils/chsh.c b/login-utils/chsh.c -index 3497120..3b446be 100644 ---- a/login-utils/chsh.c -+++ b/login-utils/chsh.c -@@ -210,6 +210,7 @@ static char *ask_new_shell(char *question, char *oldshell) - if ((ans = readline(" ")) == NULL) - #else - putchar(' '); -+ fflush(stdout); - if (getline(&ans, &dummy, stdin) < 0) - #endif - return NULL; --- -2.27.0 - diff --git a/backport-fix-by-ignoring-EINVAL-on-remount-of-proc.patch b/backport-fix-by-ignoring-EINVAL-on-remount-of-proc.patch deleted file mode 100644 index 38d663e..0000000 --- a/backport-fix-by-ignoring-EINVAL-on-remount-of-proc.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 1961dccea09176a401bc8fc5e1769ab426308314 Mon Sep 17 00:00:00 2001 -From: benaryorg -Date: Fri, 4 Jun 2021 12:34:52 +0000 -Subject: [PATCH] fix #648 by ignoring EINVAL on-remount of proc - -When using --mount-proc=/some/path then unshare fails if the path provided is not already mounted due to the mount(2) call to change the propagation of the mount. -In such a case mount(2) returns EINVAL, which however is used for a variety of other errors. -If this error is ignored mistakenly the effects however should be neglible since: - -1. the mount of proc afterwards happens regardless, errors of which are not ignored -2. the propagation change of root uses MS_REC, which shold already change the propagation of all mounts recursively - -Furthermore /proc is not touched if --mount-proc specifies a different mount point. -This should not cause too much unexpected behaviour due to point 2 from above in any case. -Specifying --mount-proc with a different path also means that unshare(3) is not instructed to touch /proc, thus /proc not being touched should not be unexpected. -As a side note, if unshare is called with /proc as an (implicit) parameter to --mount-proc then /proc is a stacked mount, meaning if /proc is unmounted it in the namespace the host /proc is visible again, thus not touching /proc with a different parameter does not constitute more information leakage than the alternative, quite contary it may even be the desired behaviour. - -Signed-off-by: benaryorg ---- - sys-utils/unshare.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/sys-utils/unshare.c b/sys-utils/unshare.c -index e5627d3c64..820691ba35 100644 ---- a/sys-utils/unshare.c -+++ b/sys-utils/unshare.c -@@ -650,8 +650,11 @@ int main(int argc, char *argv[]) - err(EXIT_FAILURE, _("cannot chdir to '%s'"), newdir); - - if (procmnt) { -- if (!newroot && mount("none", procmnt, NULL, MS_PRIVATE|MS_REC, NULL) != 0) -- err(EXIT_FAILURE, _("cannot change %s filesystem propagation"), procmnt); -+ if (!newroot && mount("none", procmnt, NULL, MS_PRIVATE|MS_REC, NULL)) -+ /* custom procmnt means that proc is very likely not mounted, causing EINVAL -+ ignoring the error in this specific instance is safe */ -+ if(errno != EINVAL) -+ err(EXIT_FAILURE, _("cannot change %s filesystem propagation"), procmnt); - if (mount("proc", procmnt, "proc", MS_NOSUID|MS_NOEXEC|MS_NODEV, NULL) != 0) - err(EXIT_FAILURE, _("mount %s failed"), procmnt); - } diff --git a/backport-flush-stdout-before-reading-stdin-and-fix-uninitialized-variable.patch b/backport-flush-stdout-before-reading-stdin-and-fix-uninitialized-variable.patch deleted file mode 100644 index b246599..0000000 --- a/backport-flush-stdout-before-reading-stdin-and-fix-uninitialized-variable.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 05907d0d9e7c85f33e168feab1eb36b464425054 Mon Sep 17 00:00:00 2001 -From: Lorenzo Beretta -Date: Mon, 25 Oct 2021 14:06:00 +0200 -Subject: [PATCH] chfn: flush stdout before reading stdin and fix uninitialized - variable - -Same problem as described in https://github.com/karelzak/util-linux/pull/1481 - -Signed-off-by: Lorenzo Beretta - ---- - login-utils/chfn.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/login-utils/chfn.c b/login-utils/chfn.c -index 2508e14..ece5cdc 100644 ---- a/login-utils/chfn.c -+++ b/login-utils/chfn.c -@@ -227,7 +227,7 @@ static char *ask_new_field(struct chfn_control *ctl, const char *question, - char *def_val) - { - int len; -- char *buf; -+ char *buf = NULL; /* leave initialized to NULL or getline segfaults */ - #ifndef HAVE_LIBREADLINE - size_t dummy = 0; - #endif -@@ -242,6 +242,7 @@ static char *ask_new_field(struct chfn_control *ctl, const char *question, - if ((buf = readline(" ")) == NULL) - #else - putchar(' '); -+ fflush(stdout); - if (getline(&buf, &dummy, stdin) < 0) - #endif - errx(EXIT_FAILURE, _("Aborted.")); --- -2.27.0 - diff --git a/backport-fsck-Processes-may-kill-other-processes.patch b/backport-fsck-Processes-may-kill-other-processes.patch deleted file mode 100644 index 72efa9f..0000000 --- a/backport-fsck-Processes-may-kill-other-processes.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 240f2ea95724a2045afebef703f9a7e62326b603 Mon Sep 17 00:00:00 2001 -From: zhanchengbin -Date: Mon, 10 Oct 2022 17:23:24 +0800 -Subject: [PATCH] fsck: Processes may kill other processes. - -A error in disk-utils/fsck.c, if run the fsck -N command, processes -don't execute, just show what would be done. However, the pid whose -value is -1 is added to the instance_list list in the execute -function,if the kill_all function is called later, kill(-1, signum) -is executed, Signals are sent to all processes except the number one -process and itself. Other processes will be killed if they use the -default signal processing function. - -Signed-off-by: zhanchengbin -Reviewed-by: Lukas Czerner ---- - disk-utils/fsck.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c -index 505952c81..800d3ce08 100644 ---- a/disk-utils/fsck.c -+++ b/disk-utils/fsck.c -@@ -730,6 +730,8 @@ static int kill_all(int signum) - for (inst = instance_list; inst; inst = inst->next) { - if (inst->flags & FLAG_DONE) - continue; -+ if (inst->pid <= 0) -+ continue; - kill(inst->pid, signum); - n++; - } --- -2.27.0 - diff --git a/backport-fstat-dir-itself.patch b/backport-fstat-dir-itself.patch deleted file mode 100644 index aceb3fb..0000000 --- a/backport-fstat-dir-itself.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 2f26f8aae1ece618ff7ade997609509f0b60d400 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 6 Sep 2021 11:52:09 +0200 -Subject: [PATCH] lib/path: fstat dir itself - -Signed-off-by: Karel Zak ---- - lib/path.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/lib/path.c b/lib/path.c -index 21f9bd1..f0b010e 100644 ---- a/lib/path.c -+++ b/lib/path.c -@@ -350,10 +350,12 @@ int ul_path_stat(struct path_cxt *pc, struct stat *sb, const char *path) - int dir = ul_path_get_dirfd(pc); - if (dir < 0) - return dir; -- if (*path == '/') -- path++; -- -- rc = fstatat(dir, path, sb, 0); -+ if (path) { -+ if (*path == '/') -+ path++; -+ rc = fstatat(dir, path, sb, 0); -+ } else -+ rc = fstat(dir, sb); /* dir itself */ - - if (rc && errno == ENOENT - && pc->redirect_on_enoent --- -2.33.0 - diff --git a/backport-hexdump-parse-handle-truncated-format-pattern.patch b/backport-hexdump-parse-handle-truncated-format-pattern.patch deleted file mode 100644 index 61ca0fa..0000000 --- a/backport-hexdump-parse-handle-truncated-format-pattern.patch +++ /dev/null @@ -1,45 +0,0 @@ -From e9aa06bad334b3a90ebe883dfc19b1e165a7c6cf Mon Sep 17 00:00:00 2001 -From: Ronan Pigott -Date: Thu, 23 Mar 2023 15:18:00 -0700 -Subject: [PATCH] hexdump-parse: handle truncated format pattern - -If the fmt being parsed by block_size is exactly '%', *++fmt is the -terminator and strchr will return a valid pointer to the terminator of -spec rather than NULL, the while condition will pass and subsequent -strchr will read past the end of fmt until a spec character is found -again - -ASAN aborts with the following error on the first buffer overread: - -AddressSanitizer: heap-buffer-overflow on address 0x602000000212 at pc 0x55bf1c4b2d78 bp 0x7ffe33c8cff0 sp 0x7ffe33c8cfe0 -READ of size 1 at 0x602000000212 thread T0 - #0 0x55bf1c4b2d77 in block_size ../text-utils/hexdump-parse.c:207 - #1 0x55bf1c4ad36f in main ../text-utils/hexdump.c:214 - #2 0x7f15f063c78f (/usr/lib/libc.so.6+0x2378f) - #3 0x7f15f063c849 in __libc_start_main (/usr/lib/libc.so.6+0x23849) - #4 0x55bf1c4ac6c4 in _start (../build/hexdump+0x86c4) ---- - text-utils/hexdump-parse.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/text-utils/hexdump-parse.c b/text-utils/hexdump-parse.c -index 0ceff8f21..272bb24e3 100644 ---- a/text-utils/hexdump-parse.c -+++ b/text-utils/hexdump-parse.c -@@ -204,10 +204,12 @@ int block_size(struct hexdump_fs *fs) - * skip any special chars -- save precision in - * case it's a %s format. - */ -- while (strchr(spec + 1, *++fmt)) -+ while (strchr(spec + 1, *++fmt) && *fmt != '\0') - ; - if (*fmt == '.' && isdigit(*++fmt)) - fmt = next_number(fmt, &prec); -+ if (*fmt == '\0') -+ badfmt(fu->fmt); - if (first_letter(fmt, "diouxX")) - bcnt += 4; - else if (first_letter(fmt, "efgEG")) --- -2.27.0 - diff --git a/backport-ipc_msg_get_limits-always-initialize-memory.patch b/backport-ipc_msg_get_limits-always-initialize-memory.patch deleted file mode 100644 index 690f94a..0000000 --- a/backport-ipc_msg_get_limits-always-initialize-memory.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 970ed62e716d1cb347e983c9a96647be5455e713 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= -Date: Sat, 7 Jan 2023 14:36:11 +0000 -Subject: [PATCH] ipc_msg_get_limits: always initialize memory - ---- - sys-utils/ipcutils.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/sys-utils/ipcutils.c b/sys-utils/ipcutils.c -index 226a43111..305ddd700 100644 ---- a/sys-utils/ipcutils.c -+++ b/sys-utils/ipcutils.c -@@ -18,6 +18,8 @@ - - int ipc_msg_get_limits(struct ipc_limits *lim) - { -+ memset(lim, 0, sizeof(*lim)); -+ - if (access(_PATH_PROC_IPC_MSGMNI, F_OK) == 0 && - access(_PATH_PROC_IPC_MSGMNB, F_OK) == 0 && - access(_PATH_PROC_IPC_MSGMAX, F_OK) == 0) { --- -2.27.0 - diff --git a/backport-iso9660.h-avoid-undefined-signed-integer-shift.patch b/backport-iso9660.h-avoid-undefined-signed-integer-shift.patch deleted file mode 100644 index 3046618..0000000 --- a/backport-iso9660.h-avoid-undefined-signed-integer-shift.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 893fe60d0b8f14d9a3022f6f95637e43b17f1b8b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= -Date: Tue, 13 Dec 2022 02:40:02 +0000 -Subject: [PATCH] iso9660.h: avoid undefined signed integer shift - -When the high bit in p[3] is set we would overflow our signed 4-byte -integer result value. -Force an unsigned type instead. ---- - include/iso9660.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/include/iso9660.h b/include/iso9660.h -index cbc45dbb4..ed402d8c8 100644 ---- a/include/iso9660.h -+++ b/include/iso9660.h -@@ -34,7 +34,7 @@ static inline uint32_t isonum_731(const unsigned char *p) - return ((p[0] & 0xff) - | ((p[1] & 0xff) << 8) - | ((p[2] & 0xff) << 16) -- | ((p[3] & 0xff) << 24)); -+ | (((uint32_t) p[3] & 0xff) << 24)); - } - - static inline uint32_t isonum_732(const unsigned char *p) -@@ -42,7 +42,7 @@ static inline uint32_t isonum_732(const unsigned char *p) - return ((p[3] & 0xff) - | ((p[2] & 0xff) << 8) - | ((p[1] & 0xff) << 16) -- | ((p[0] & 0xff) << 24)); -+ | (((uint32_t) p[0] & 0xff) << 24)); - } - - static inline uint32_t isonum_733(const unsigned char *p, bool check_match) --- -2.27.0 - diff --git a/backport-iso9660.h-use-more-correct-function-types.patch b/backport-iso9660.h-use-more-correct-function-types.patch deleted file mode 100644 index b02a7fb..0000000 --- a/backport-iso9660.h-use-more-correct-function-types.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 9fc18efe956956be078fbbcea2144f0bb1b33b30 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= -Date: Tue, 13 Dec 2022 02:38:27 +0000 -Subject: [PATCH] iso9660.h: use more correct function types - ---- - include/iso9660.h | 21 +++++++++++---------- - 1 file changed, 11 insertions(+), 10 deletions(-) - -diff --git a/include/iso9660.h b/include/iso9660.h -index 73decd998..cbc45dbb4 100644 ---- a/include/iso9660.h -+++ b/include/iso9660.h -@@ -2,25 +2,26 @@ - #define UTIL_LINUX_ISO_H - - #include -+#include - - #include "c.h" - --static inline int isonum_721(unsigned char *p) -+static inline uint16_t isonum_721(const unsigned char *p) - { - return ((p[0] & 0xff) - | ((p[1] & 0xff) << 8)); - } - --static inline int isonum_722(unsigned char *p) -+static inline uint16_t isonum_722(const unsigned char *p) - { - return ((p[1] & 0xff) - | ((p[0] & 0xff) << 8)); - } - --static inline int isonum_723(unsigned char *p, bool check_match) -+static inline uint16_t isonum_723(const unsigned char *p, bool check_match) - { -- int le = isonum_721(p); -- int be = isonum_722(p + 2); -+ uint16_t le = isonum_721(p); -+ uint16_t be = isonum_722(p + 2); - - if (check_match && le != be) - /* translation is useless */ -@@ -28,7 +29,7 @@ static inline int isonum_723(unsigned char *p, bool check_match) - return (le); - } - --static inline int isonum_731(unsigned char *p) -+static inline uint32_t isonum_731(const unsigned char *p) - { - return ((p[0] & 0xff) - | ((p[1] & 0xff) << 8) -@@ -36,7 +37,7 @@ static inline int isonum_731(unsigned char *p) - | ((p[3] & 0xff) << 24)); - } - --static inline int isonum_732(unsigned char *p) -+static inline uint32_t isonum_732(const unsigned char *p) - { - return ((p[3] & 0xff) - | ((p[2] & 0xff) << 8) -@@ -44,10 +45,10 @@ static inline int isonum_732(unsigned char *p) - | ((p[0] & 0xff) << 24)); - } - --static inline int isonum_733(unsigned char *p, bool check_match) -+static inline uint32_t isonum_733(const unsigned char *p, bool check_match) - { -- int le = isonum_731(p); -- int be = isonum_732(p + 4); -+ uint32_t le = isonum_731(p); -+ uint32_t be = isonum_732(p + 4); - - if (check_match && le != be) - /* translation is useless */ --- -2.27.0 - diff --git a/backport-last-don-t-assume-zero-terminate-strings.patch b/backport-last-don-t-assume-zero-terminate-strings.patch deleted file mode 100644 index 323aa59..0000000 --- a/backport-last-don-t-assume-zero-terminate-strings.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 6cd0043221b31a344db8f5dcb82822a2519a2e74 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 7 Feb 2022 13:34:43 +0100 -Subject: [PATCH] last: don't assume zero terminate strings - -Detected by fuzzer and AddressSanitizer. The utmp strings do not -have to be zero terminated. - -Signed-off-by: Karel Zak ---- - login-utils/last.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/login-utils/last.c b/login-utils/last.c -index c7aec4c116..84629278e5 100644 ---- a/login-utils/last.c -+++ b/login-utils/last.c -@@ -757,7 +757,7 @@ static void process_wtmp_file(const struct last_control *ctl, - else { - if (ut.ut_type != DEAD_PROCESS && - ut.ut_user[0] && ut.ut_line[0] && -- strcmp(ut.ut_user, "LOGIN") != 0) -+ strncmp(ut.ut_user, "LOGIN", 5) != 0) - ut.ut_type = USER_PROCESS; - /* - * Even worse, applications that write ghost -@@ -770,7 +770,7 @@ static void process_wtmp_file(const struct last_control *ctl, - /* - * Clock changes. - */ -- if (strcmp(ut.ut_user, "date") == 0) { -+ if (strncmp(ut.ut_user, "date", 4) == 0) { - if (ut.ut_line[0] == '|') - ut.ut_type = OLD_TIME; - if (ut.ut_line[0] == '{') diff --git a/backport-ldattach-fix-intro-command-and-pause.patch b/backport-ldattach-fix-intro-command-and-pause.patch deleted file mode 100644 index d6a5eb3..0000000 --- a/backport-ldattach-fix-intro-command-and-pause.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 5bd28f494ece506daa58861bf46e726c3958021e Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 5 Dec 2022 12:36:42 +0100 -Subject: [PATCH] ldattach: fix --intro-command and --pause - -The long version of the command line options should not ignore arguments. - -Fixes: https://github.com/util-linux/util-linux/issues/1940 -Signed-off-by: Karel Zak ---- - sys-utils/ldattach.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sys-utils/ldattach.c b/sys-utils/ldattach.c -index 3c853f829..0a6b6f2d2 100644 ---- a/sys-utils/ldattach.c -+++ b/sys-utils/ldattach.c -@@ -303,8 +303,8 @@ int main(int argc, char **argv) - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'V'}, - {"debug", no_argument, NULL, 'd'}, -- {"intro-command", no_argument, NULL, 'c'}, -- {"pause", no_argument, NULL, 'p'}, -+ {"intro-command", required_argument, NULL, 'c'}, -+ {"pause", required_argument, NULL, 'p'}, - {NULL, 0, NULL, 0} - }; - --- -2.27.0 - diff --git a/backport-lib-allow-safe_getenv-to-work-for-non-root-users.patch b/backport-lib-allow-safe_getenv-to-work-for-non-root-users.patch deleted file mode 100644 index 051cd51..0000000 --- a/backport-lib-allow-safe_getenv-to-work-for-non-root-users.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 16a2e0603f15c4a8f4517264930c7bdea5885bae Mon Sep 17 00:00:00 2001 -From: Mike Gilbert -Date: Tue, 26 Apr 2022 13:58:12 -0400 -Subject: [PATCH] lib: allow safe_getenv to work for non-root users - -This allows users to override settings like BLKID_FILE, as is done in -the e2fsprogs test suite. - -Bug: https://bugs.gentoo.org/839825 -Fixes: 035507c84b53bceb143d0923e65916cbf90979c7 -Signed-off-by: Mike Gilbert ---- - lib/env.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/lib/env.c b/lib/env.c -index a3dd335bfe..37125f4d5a 100644 ---- a/lib/env.c -+++ b/lib/env.c -@@ -161,9 +161,7 @@ void sanitize_env(void) - - char *safe_getenv(const char *arg) - { -- uid_t ruid = getuid(); -- -- if (ruid != 0 || (ruid != geteuid()) || (getgid() != getegid())) -+ if ((getuid() != geteuid()) || (getgid() != getegid())) - return NULL; - #ifdef HAVE_PRCTL - if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) diff --git a/backport-lib-pager-fix-signal-safety-issues.patch b/backport-lib-pager-fix-signal-safety-issues.patch deleted file mode 100644 index a0fe493..0000000 --- a/backport-lib-pager-fix-signal-safety-issues.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 518a0ad4d9c586ca69d3cf924a4328361f6b2a80 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= -Date: Sun, 15 Jan 2023 01:33:14 +0000 -Subject: [PATCH] lib:pager: fix signal safety issues - -- Cannot use stdio in signal handlers, so you cannot safely call - fflush. -- cannot call exit() but only _exit() ---- - lib/pager.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/lib/pager.c b/lib/pager.c -index e5bd07a47..8f62310c0 100644 ---- a/lib/pager.c -+++ b/lib/pager.c -@@ -114,7 +114,9 @@ static int wait_or_whine(pid_t pid) - if (waiting < 0) { - if (errno == EINTR) - continue; -- err(EXIT_FAILURE, _("waitpid failed (%s)"), strerror(errno)); -+ /* Can't err() on signal handler */ -+ ignore_result(write(STDERR_FILENO, "waitpid failed", 14)); -+ _exit(EXIT_FAILURE); - } - if (waiting != pid) - return -1; -@@ -163,8 +165,6 @@ static void wait_for_pager(void) - if (pager_process.pid == 0) - return; - -- fflush(stdout); -- fflush(stderr); - /* signal EOF to pager */ - close(STDOUT_FILENO); - close(STDERR_FILENO); --- -2.27.0 - diff --git a/backport-lib-path-make-path-use-more-robust-coverity-scan.patch b/backport-lib-path-make-path-use-more-robust-coverity-scan.patch deleted file mode 100644 index 1f651e8..0000000 --- a/backport-lib-path-make-path-use-more-robust-coverity-scan.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 41a27709e9028940578a5cdae17292e432fa23fa Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 29 Nov 2021 13:25:16 +0100 -Subject: [PATCH] lib/path: make path use more robust [coverity scan] - -*** CID 374365: Null pointer dereferences (FORWARD_NULL) -/lib/path.c: 364 in ul_path_stat() - -Signed-off-by: Karel Zak ---- - lib/path.c | 5 ++++- - lib/sysfs.c | 2 +- - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/lib/path.c b/lib/path.c -index 0d357966f3..8a2b882fe4 100644 ---- a/lib/path.c -+++ b/lib/path.c -@@ -344,7 +344,7 @@ int ul_path_stat(struct path_cxt *pc, struct stat *sb, int flags, const char *pa - int rc; - - if (!pc) { -- rc = stat(path, sb); -+ rc = path ? stat(path, sb) : -EINVAL; - DBG(CXT, ul_debug("stat '%s' [no context, rc=%d]", path, rc)); - } else { - int dir = ul_path_get_dirfd(pc); -@@ -359,6 +359,7 @@ int ul_path_stat(struct path_cxt *pc, struct stat *sb, int flags, const char *pa - rc = fstat(dir, sb); /* dir itself */ - - if (rc && errno == ENOENT -+ && path - && pc->redirect_on_enoent - && pc->redirect_on_enoent(pc, path, &dir) == 0) - rc = fstatat(dir, path, sb, 0); -@@ -372,6 +373,8 @@ int ul_path_open(struct path_cxt *pc, int flags, const char *path) - { - int fd; - -+ if (!path) -+ return -EINVAL; - if (!pc) { - fd = open(path, flags); - DBG(CXT, ul_debug("opening '%s' [no context]", path)); -diff --git a/lib/sysfs.c b/lib/sysfs.c -index d8206be7ab..84af4fe3cb 100644 ---- a/lib/sysfs.c -+++ b/lib/sysfs.c -@@ -165,7 +165,7 @@ static int sysfs_blkdev_enoent_redirect(struct path_cxt *pc, const char *path, i - { - struct sysfs_blkdev *blk = ul_path_get_dialect(pc); - -- if (blk && blk->parent && strncmp(path, "queue/", 6) == 0) { -+ if (blk && blk->parent && path && strncmp(path, "queue/", 6) == 0) { - *dirfd = ul_path_get_dirfd(blk->parent); - if (*dirfd >= 0) { - DBG(CXT, ul_debugobj(pc, "%s redirected to parent", path)); diff --git a/backport-lib-path-make-ul_path_read_buffer-more-robust-coverity-scan.patch b/backport-lib-path-make-ul_path_read_buffer-more-robust-coverity-scan.patch deleted file mode 100644 index 343c266..0000000 --- a/backport-lib-path-make-ul_path_read_buffer-more-robust-coverity-scan.patch +++ /dev/null @@ -1,42 +0,0 @@ -From ea459dcf95d0bb04c816b71d2b85fbcd8cfc5ee4 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 17 Mar 2022 12:18:03 +0100 -Subject: [PATCH] lib/path: make ul_path_read_buffer() more robust [coverity - scan] - -Make sure we never call buf[rc - 1] for rc=0. - -Signed-off-by: Karel Zak ---- - lib/path.c | 17 ++++++++++------- - 1 file changed, 10 insertions(+), 7 deletions(-) - -diff --git a/lib/path.c b/lib/path.c -index 8a2b882fe4..20a3ea15d2 100644 ---- a/lib/path.c -+++ b/lib/path.c -@@ -672,14 +672,17 @@ int ul_path_readf_string(struct path_cxt *pc, char **str, const char *path, ...) - int ul_path_read_buffer(struct path_cxt *pc, char *buf, size_t bufsz, const char *path) - { - int rc = ul_path_read(pc, buf, bufsz - 1, path); -- if (rc < 0) -- return rc; - -- /* Remove tailing newline (usual in sysfs) */ -- if (rc > 0 && *(buf + rc - 1) == '\n') -- buf[--rc] = '\0'; -- else -- buf[rc - 1] = '\0'; -+ if (rc == 0) -+ buf[0] = '\0'; -+ -+ else if (rc > 0) { -+ /* Remove tailing newline (usual in sysfs) */ -+ if (*(buf + rc - 1) == '\n') -+ buf[--rc] = '\0'; -+ else -+ buf[rc - 1] = '\0'; -+ } - - return rc; - } diff --git a/backport-lib-strutils-improve-strtoul_or_err-for-negative-numbers.patch b/backport-lib-strutils-improve-strtoul_or_err-for-negative-numbers.patch deleted file mode 100644 index e0c65ce..0000000 --- a/backport-lib-strutils-improve-strtoul_or_err-for-negative-numbers.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 3b888573661d43ea069e98a083bd10e33a2ece69 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 19 Apr 2022 11:38:57 +0200 -Subject: [PATCH] lib/strutils: improve strtoul_or_err() for negative numbers - -Let's use the same code for strtoul_or_err() and strtol_or_err() as we -already use for strtoxXX_or_err() functions. It resolves issue with -negative numbers. - -This problem has been discovered by "./eject -x -1 -v" where -x is -based on strtoul_or_err(), but accepts negative number (-1). - -Reported-by: Enze Li -Signed-off-by: Karel Zak ---- - include/strutils.h | 4 ++-- - lib/strutils.c | 42 ------------------------------------------ - 2 files changed, 2 insertions(+), 44 deletions(-) - -diff --git a/include/strutils.h b/include/strutils.h -index a84d295..2849ef3 100644 ---- a/include/strutils.h -+++ b/include/strutils.h -@@ -42,8 +42,8 @@ extern uint64_t str2unum_or_err(const char *str, int base, const char *errmesg, - extern double strtod_or_err(const char *str, const char *errmesg); - extern long double strtold_or_err(const char *str, const char *errmesg); - --extern long strtol_or_err(const char *str, const char *errmesg); --extern unsigned long strtoul_or_err(const char *str, const char *errmesg); -+#define strtol_or_err(_s, _e) (long) str2num_or_err(_s, 10, _e, LONG_MIN, LONG_MAX) -+#define strtoul_or_err(_s, _e) (unsigned long) str2unum_or_err(_s, 10, _e, ULONG_MAX) - - extern void strtotimeval_or_err(const char *str, struct timeval *tv, - const char *errmesg); -diff --git a/lib/strutils.c b/lib/strutils.c -index 096aaf5..4117e03 100644 ---- a/lib/strutils.c -+++ b/lib/strutils.c -@@ -471,48 +471,6 @@ err: - errx(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str); - } - --long strtol_or_err(const char *str, const char *errmesg) --{ -- long num; -- char *end = NULL; -- -- errno = 0; -- if (str == NULL || *str == '\0') -- goto err; -- num = strtol(str, &end, 10); -- -- if (errno || str == end || (end && *end)) -- goto err; -- -- return num; --err: -- if (errno == ERANGE) -- err(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str); -- -- errx(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str); --} -- --unsigned long strtoul_or_err(const char *str, const char *errmesg) --{ -- unsigned long num; -- char *end = NULL; -- -- errno = 0; -- if (str == NULL || *str == '\0') -- goto err; -- num = strtoul(str, &end, 10); -- -- if (errno || str == end || (end && *end)) -- goto err; -- -- return num; --err: -- if (errno == ERANGE) -- err(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str); -- -- errx(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str); --} -- - uintmax_t strtosize_or_err(const char *str, const char *errmesg) - { - uintmax_t num; --- -2.27.0 - diff --git a/backport-libblkid-avoid-buffer-overflow-in-ocfs-superblock-parsing.patch b/backport-libblkid-avoid-buffer-overflow-in-ocfs-superblock-parsing.patch deleted file mode 100644 index b7af88c..0000000 --- a/backport-libblkid-avoid-buffer-overflow-in-ocfs-superblock-parsing.patch +++ /dev/null @@ -1,39 +0,0 @@ -From d7fa8ed63891b0058c5df8aa809e34de61008f51 Mon Sep 17 00:00:00 2001 -From: Milan Broz -Date: Sun, 9 Oct 2022 20:20:45 +0200 -Subject: [PATCH] libblkid: avoid buffer overflow in ocfs superblock parsing - -Label and mount values are checked only according to on-disk -values and not checked against the real structure size. -This can lead to reading of memory outside of superblock -struct and subsequent crash. - -Reproducer found with OSS-Fuzz (issue 52270) running over -cryptsetup project (blkid is used in header init). - -Signed-off-by: Milan Broz ---- - libblkid/src/superblocks/ocfs.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/libblkid/src/superblocks/ocfs.c b/libblkid/src/superblocks/ocfs.c -index 28df6ddfa4..e213d66b44 100644 ---- a/libblkid/src/superblocks/ocfs.c -+++ b/libblkid/src/superblocks/ocfs.c -@@ -129,10 +129,12 @@ static int probe_ocfs(blkid_probe pr, const struct blkid_idmag *mag) - blkid_probe_set_value(pr, "SEC_TYPE", - (unsigned char *) "ntocfs", sizeof("ntocfs")); - -- blkid_probe_set_label(pr, (unsigned char *) ovl.label, -- ocfslabellen(ovl)); -- blkid_probe_set_value(pr, "MOUNT", (unsigned char *) ovh.mount, -- ocfsmountlen(ovh)); -+ if (ocfslabellen(ovl) < sizeof(ovl.label)) -+ blkid_probe_set_label(pr, (unsigned char *) ovl.label, -+ ocfslabellen(ovl)); -+ if (ocfsmountlen(ovh) < sizeof(ovh.mount)) -+ blkid_probe_set_value(pr, "MOUNT", (unsigned char *) ovh.mount, -+ ocfsmountlen(ovh)); - blkid_probe_set_uuid(pr, ovl.vol_id); - blkid_probe_sprintf_version(pr, "%u.%u", maj, min); - return 0; diff --git a/backport-libblkid-bsd-fix-buffer-pointer-use-fuzzing.patch b/backport-libblkid-bsd-fix-buffer-pointer-use-fuzzing.patch deleted file mode 100644 index 74e28c0..0000000 --- a/backport-libblkid-bsd-fix-buffer-pointer-use-fuzzing.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0a0630133055c3b3daa3072a3fd9944a1a149401 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 2 Jun 2022 16:02:54 +0200 -Subject: [PATCH] libblkid: (bsd) fix buffer pointer use [fuzzing] - -Reported-by: Thibault Guittet -Signed-off-by: Karel Zak ---- - libblkid/src/partitions/bsd.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libblkid/src/partitions/bsd.c b/libblkid/src/partitions/bsd.c -index c74517334f..7a0b23195e 100644 ---- a/libblkid/src/partitions/bsd.c -+++ b/libblkid/src/partitions/bsd.c -@@ -50,7 +50,7 @@ static int probe_bsd_pt(blkid_probe pr, const struct blkid_idmag *mag) - goto nothing; - } - -- l = (struct bsd_disklabel *) data + BLKID_MAG_LASTOFFSET(mag); -+ l = (struct bsd_disklabel *) (data + BLKID_MAG_LASTOFFSET(mag)); - - ls = blkid_probe_get_partlist(pr); - if (!ls) diff --git a/backport-libblkid-check-fsync-return-code.patch b/backport-libblkid-check-fsync-return-code.patch deleted file mode 100644 index 723f66a..0000000 --- a/backport-libblkid-check-fsync-return-code.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 133a0d70f637b4f4e4337811e452153b04f2bdcf Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 19 Apr 2022 09:44:07 +0200 -Subject: [PATCH] libblkid: check fsync() return code - -Since 39f5af25982d8b0244000e92a9d0e0e6557d0e17 libblkid uses -O_NONBLOCK. Now it's more obvious that check fsync() (and close()) -return value after write() is always a good idea ... - -Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2074486 -Signed-off-by: Karel Zak ---- - libblkid/src/probe.c | 3 ++- - misc-utils/wipefs.c | 8 ++++++-- - 2 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c -index 80db524..3e8a7a0 100644 ---- a/libblkid/src/probe.c -+++ b/libblkid/src/probe.c -@@ -1299,7 +1299,8 @@ int blkid_do_wipe(blkid_probe pr, int dryrun) - /* wipen on device */ - if (write_all(fd, buf, len)) - return -1; -- fsync(fd); -+ if (fsync(fd) != 0) -+ return -1; - pr->flags &= ~BLKID_FL_MODIF_BUFF; /* be paranoid */ - - return blkid_probe_step_back(pr); -diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c -index 78dc63e..f08a9ba 100644 ---- a/misc-utils/wipefs.c -+++ b/misc-utils/wipefs.c -@@ -615,7 +615,9 @@ static int do_wipe(struct wipe_control *ctl) - if (need_force) - warnx(_("Use the --force option to force erase.")); - -- fsync(blkid_probe_get_fd(pr)); -+ if (fsync(blkid_probe_get_fd(pr)) != 0) -+ err(EXIT_FAILURE, _("%s: cannot flush modified buffers"), -+ ctl->devname); - - #ifdef BLKRRPART - if (reread && (mode & O_EXCL)) { -@@ -635,7 +637,9 @@ static int do_wipe(struct wipe_control *ctl) - } - #endif - -- close(blkid_probe_get_fd(pr)); -+ if (close(blkid_probe_get_fd(pr)) != 0) -+ err(EXIT_FAILURE, _("%s: close device failed"), ctl->devname); -+ - blkid_free_probe(pr); - free(backup); - return 0; --- -2.27.0 - diff --git a/backport-libblkid-cleanup-indentation.patch b/backport-libblkid-cleanup-indentation.patch deleted file mode 100644 index 07aa00f..0000000 --- a/backport-libblkid-cleanup-indentation.patch +++ /dev/null @@ -1,32 +0,0 @@ -From c7471d8b3d4e796eee8ae041e5cbb55c5619318e Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 19 Oct 2022 11:24:30 +0200 -Subject: [PATCH] libblkid: cleanup indentation - -Signed-off-by: Karel Zak ---- - libblkid/src/superblocks/jmicron_raid.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/libblkid/src/superblocks/jmicron_raid.c b/libblkid/src/superblocks/jmicron_raid.c -index 9ef8cd3f8..ab2c829f0 100644 ---- a/libblkid/src/superblocks/jmicron_raid.c -+++ b/libblkid/src/superblocks/jmicron_raid.c -@@ -17,10 +17,10 @@ - #include "superblocks.h" - - #define JM_SIGNATURE "JM" --#define JM_MINOR_VERSION(_x) ((_x)->version & 0xFF) --#define JM_MAJOR_VERSION(_x) ((_x)->version >> 8) --#define JM_SPARES 2 --#define JM_MEMBERS 8 -+#define JM_MINOR_VERSION(_x) ((_x)->version & 0xFF) -+#define JM_MAJOR_VERSION(_x) ((_x)->version >> 8) -+#define JM_SPARES 2 -+#define JM_MEMBERS 8 - - struct jm_metadata { - int8_t signature[2]; /* 0x0 - 0x01 */ --- -2.27.0 - diff --git a/backport-libblkid-copy-BLKID_PARTS_FORCE_GPT-to-whole-disk-pr.patch b/backport-libblkid-copy-BLKID_PARTS_FORCE_GPT-to-whole-disk-pr.patch deleted file mode 100644 index a7b852d..0000000 --- a/backport-libblkid-copy-BLKID_PARTS_FORCE_GPT-to-whole-disk-pr.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 22769acf56daf6683d635fe92e06ceb52e0433ff Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 4 Apr 2023 11:04:51 +0200 -Subject: [PATCH] libblkid: copy BLKID_PARTS_FORCE_GPT to whole-disk prober - -Addresses: https://github.com/util-linux/util-linux/discussions/2146 -Signed-off-by: Karel Zak ---- - libblkid/src/blkidP.h | 3 +++ - libblkid/src/partitions/partitions.c | 5 +++++ - libblkid/src/probe.c | 6 ++++++ - 3 files changed, 14 insertions(+) - -diff --git a/libblkid/src/blkidP.h b/libblkid/src/blkidP.h -index 5d2a02055..007cc357b 100644 ---- a/libblkid/src/blkidP.h -+++ b/libblkid/src/blkidP.h -@@ -544,6 +544,9 @@ extern int blkid_probe_get_hint(blkid_probe pr, const char *name, uint64_t *valu - __attribute__((nonnull(1,2))) - __attribute__((warn_unused_result)); - -+extern int blkid_probe_get_partitions_flags(blkid_probe pr) -+ __attribute__((nonnull)); -+ - /* filter bitmap macros */ - #define blkid_bmp_wordsize (8 * sizeof(unsigned long)) - #define blkid_bmp_idx_bit(item) (1UL << ((item) % blkid_bmp_wordsize)) -diff --git a/libblkid/src/partitions/partitions.c b/libblkid/src/partitions/partitions.c -index ae63a38cc..1c344fd30 100644 ---- a/libblkid/src/partitions/partitions.c -+++ b/libblkid/src/partitions/partitions.c -@@ -234,6 +234,11 @@ int blkid_probe_set_partitions_flags(blkid_probe pr, int flags) - return 0; - } - -+int blkid_probe_get_partitions_flags(blkid_probe pr) -+{ -+ return pr->chains[BLKID_CHAIN_PARTS].flags; -+} -+ - /** - * blkid_probe_reset_partitions_filter: - * @pr: prober -diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c -index 35de30334..b4299493f 100644 ---- a/libblkid/src/probe.c -+++ b/libblkid/src/probe.c -@@ -1930,6 +1930,7 @@ blkid_probe blkid_probe_get_wholedisk_probe(blkid_probe pr) - if (!pr->disk_probe) { - /* Open a new disk prober */ - char *disk_path = blkid_devno_to_devname(disk); -+ int flags; - - if (!disk_path) - return NULL; -@@ -1942,6 +1943,11 @@ blkid_probe blkid_probe_get_wholedisk_probe(blkid_probe pr) - - if (!pr->disk_probe) - return NULL; /* ENOMEM? */ -+ -+ flags = blkid_probe_get_partitions_flags(pr); -+ if (flags & BLKID_PARTS_FORCE_GPT) -+ blkid_probe_set_partitions_flags(pr->disk_probe, -+ BLKID_PARTS_FORCE_GPT); - } - - return pr->disk_probe; --- -2.27.0 - diff --git a/backport-libblkid-don-t-mark-cache-as-probed-if-sys-not-available.patch b/backport-libblkid-don-t-mark-cache-as-probed-if-sys-not-available.patch deleted file mode 100644 index 18757c5..0000000 --- a/backport-libblkid-don-t-mark-cache-as-probed-if-sys-not-available.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 84d38ae3eca523ef990cb848563cc63de25266e6 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Fri, 19 Nov 2021 14:19:03 +0100 -Subject: [PATCH] libblkid: don't mark cache as "probed" if /sys not available - -For "mount --all" we need to read the cache more than once in a short -time. The library checks the delay between probes, and if the delay is -too short, it does not read devices. This is a problem on boot when there -are no /sys, and the cache is empty. In this case, we need to check -for /sys until it's available constantly. - -https://github.com/util-linux/util-linux/issues/1492 -Signed-off-by: Karel Zak ---- - libblkid/src/devname.c | 26 +++++++++++++++++--------- - libblkid/src/resolve.c | 2 +- - libblkid/src/tag.c | 8 +++++--- - 3 files changed, 23 insertions(+), 13 deletions(-) - -diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c -index c541d30..80574f3 100644 ---- a/libblkid/src/devname.c -+++ b/libblkid/src/devname.c -@@ -456,6 +456,8 @@ sysfs_probe_all(blkid_cache cache, int only_if_new, int only_removable) - if (!sysfs) - return -BLKID_ERR_SYSFS; - -+ DBG(DEVNAME, ul_debug(" probe /sys/block")); -+ - /* scan /sys/block */ - while ((dev = xreaddir(sysfs))) { - DIR *dir = NULL; -@@ -560,14 +562,18 @@ sysfs_probe_all(blkid_cache cache, int only_if_new, int only_removable) - /* - * Read the device data for all available block devices in the system. - */ --static int probe_all(blkid_cache cache, int only_if_new) -+static int probe_all(blkid_cache cache, int only_if_new, int update_interval) - { -+ int rc; -+ - if (!cache) - return -BLKID_ERR_PARAM; - - if (cache->bic_flags & BLKID_BIC_FL_PROBED && -- time(NULL) - cache->bic_time < BLKID_PROBE_INTERVAL) -+ time(NULL) - cache->bic_time < BLKID_PROBE_INTERVAL) { -+ DBG(PROBE, ul_debug("don't re-probe [delay < %d]", BLKID_PROBE_INTERVAL)); - return 0; -+ } - - blkid_read_cache(cache); - -@@ -577,7 +583,13 @@ static int probe_all(blkid_cache cache, int only_if_new) - #endif - ubi_probe_all(cache, only_if_new); - -- sysfs_probe_all(cache, only_if_new, 0); -+ rc = sysfs_probe_all(cache, only_if_new, 0); -+ -+ /* Don't mark the change as "probed" if /sys not avalable */ -+ if (update_interval && rc == 0) { -+ cache->bic_time = time(NULL); -+ cache->bic_flags |= BLKID_BIC_FL_PROBED; -+ } - - blkid_flush_cache(cache); - return 0; -@@ -596,11 +608,7 @@ int blkid_probe_all(blkid_cache cache) - int ret; - - DBG(PROBE, ul_debug("Begin blkid_probe_all()")); -- ret = probe_all(cache, 0); -- if (ret == 0) { -- cache->bic_time = time(NULL); -- cache->bic_flags |= BLKID_BIC_FL_PROBED; -- } -+ ret = probe_all(cache, 0, 1); - DBG(PROBE, ul_debug("End blkid_probe_all() [rc=%d]", ret)); - return ret; - } -@@ -618,7 +626,7 @@ int blkid_probe_all_new(blkid_cache cache) - int ret; - - DBG(PROBE, ul_debug("Begin blkid_probe_all_new()")); -- ret = probe_all(cache, 1); -+ ret = probe_all(cache, 1, 0); - DBG(PROBE, ul_debug("End blkid_probe_all_new() [rc=%d]", ret)); - return ret; - } -diff --git a/libblkid/src/resolve.c b/libblkid/src/resolve.c -index 641b022..16653fa 100644 ---- a/libblkid/src/resolve.c -+++ b/libblkid/src/resolve.c -@@ -32,7 +32,7 @@ char *blkid_get_tag_value(blkid_cache cache, const char *tagname, - blkid_cache c = cache; - char *ret = NULL; - -- DBG(TAG, ul_debug("looking for %s on %s", tagname, devname)); -+ DBG(TAG, ul_debug("looking for tag %s on %s device", tagname, devname)); - - if (!devname) - return NULL; -diff --git a/libblkid/src/tag.c b/libblkid/src/tag.c -index 390a648..1783365 100644 ---- a/libblkid/src/tag.c -+++ b/libblkid/src/tag.c -@@ -326,14 +326,14 @@ blkid_dev blkid_find_dev_with_tag(blkid_cache cache, - blkid_dev dev; - int pri; - struct list_head *p; -- int probe_new = 0; -+ int probe_new = 0, probe_all = 0; - - if (!cache || !type || !value) - return NULL; - - blkid_read_cache(cache); - -- DBG(TAG, ul_debug("looking for %s=%s in cache", type, value)); -+ DBG(TAG, ul_debug("looking for tag %s=%s in cache", type, value)); - - try_again: - pri = -1; -@@ -366,9 +366,11 @@ try_again: - goto try_again; - } - -- if (!dev && !(cache->bic_flags & BLKID_BIC_FL_PROBED)) { -+ if (!dev && !probe_all -+ && !(cache->bic_flags & BLKID_BIC_FL_PROBED)) { - if (blkid_probe_all(cache) < 0) - return NULL; -+ probe_all++; - goto try_again; - } - return dev; --- -2.27.0 - diff --git a/backport-libblkid-exfat-fix-divide-by-zero-coverity-scan.patch b/backport-libblkid-exfat-fix-divide-by-zero-coverity-scan.patch deleted file mode 100644 index 61d8a89..0000000 --- a/backport-libblkid-exfat-fix-divide-by-zero-coverity-scan.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 48229f8e7f19c1b61a089fc9ede18d417a895454 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 24 Oct 2022 10:54:24 +0200 -Subject: [PATCH] libblkid: (exfat) fix divide by zero [coverity scan] - -Signed-off-by: Karel Zak ---- - libblkid/src/superblocks/exfat.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libblkid/src/superblocks/exfat.c b/libblkid/src/superblocks/exfat.c -index 9d1309425..398619477 100644 ---- a/libblkid/src/superblocks/exfat.c -+++ b/libblkid/src/superblocks/exfat.c -@@ -101,7 +101,7 @@ static struct exfat_entry_label *find_label(blkid_probe pr, - return (struct exfat_entry_label *) entry; - - offset += EXFAT_ENTRY_SIZE; -- if (offset % CLUSTER_SIZE(sb) == 0) { -+ if (CLUSTER_SIZE(sb) && (offset % CLUSTER_SIZE(sb)) == 0) { - cluster = next_cluster(pr, sb, cluster); - if (cluster < EXFAT_FIRST_DATA_CLUSTER) - return NULL; --- -2.27.0 - diff --git a/backport-libblkid-fix-jmicron-checksum-and-LE-to-CPU.patch b/backport-libblkid-fix-jmicron-checksum-and-LE-to-CPU.patch deleted file mode 100644 index b7006ea..0000000 --- a/backport-libblkid-fix-jmicron-checksum-and-LE-to-CPU.patch +++ /dev/null @@ -1,92 +0,0 @@ -From cb92f0d82ae634e46989d3dae673ae3f542f7dd9 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Fri, 21 Oct 2022 18:11:59 +0200 -Subject: [PATCH] libblkid: fix jmicron checksum and LE to CPU - -- don't cast packed struct to uint16_t pointer, use temporary value -- calculate real count for the loop -- convert all to LE for checksum calculation (jm_to_cpu() ignores fillers) - -Signed-off-by: Karel Zak ---- - libblkid/src/superblocks/jmicron_raid.c | 44 ++++++++++++++----------- - 1 file changed, 25 insertions(+), 19 deletions(-) - -diff --git a/libblkid/src/superblocks/jmicron_raid.c b/libblkid/src/superblocks/jmicron_raid.c -index ab2c829f0..580c38533 100644 ---- a/libblkid/src/superblocks/jmicron_raid.c -+++ b/libblkid/src/superblocks/jmicron_raid.c -@@ -55,35 +55,38 @@ static void jm_to_cpu(struct jm_metadata *jm) - { - unsigned int i; - -- le16_to_cpu(jm->version); -- le16_to_cpu(jm->checksum); -- le32_to_cpu(jm->identity); -+ jm->version = le16_to_cpu(jm->version); -+ jm->checksum = le16_to_cpu(jm->checksum); -+ jm->identity = le32_to_cpu(jm->identity); -+ jm->segment.base = le32_to_cpu(jm->segment.base); -+ jm->segment.range = le32_to_cpu(jm->segment.range); -+ jm->segment.range2 = le16_to_cpu(jm->segment.range2); - -- le32_to_cpu(jm->segment.base); -- le32_to_cpu(jm->segment.range); -- le16_to_cpu(jm->segment.range2); -- -- le16_to_cpu(jm->attribute); -+ jm->attribute = le16_to_cpu(jm->attribute); - - for (i = 0; i < JM_SPARES; i++) -- le32_to_cpu(jm->spare[i]); -+ jm->spare[i] = le32_to_cpu(jm->spare[i]); - - for (i = 0; i < JM_MEMBERS; i++) -- le32_to_cpu(jm->member[i]); -+ jm->member[i] = le32_to_cpu(jm->member[i]); - } - --static int jm_checksum(struct jm_metadata *jm) -+static int jm_checksum(const struct jm_metadata *jm) - { -- size_t count = 64; -- char *buf = (char *) jm; -- uint16_t *p = (uint16_t *) buf, sum = 0; -+ size_t count = sizeof(*jm) / sizeof(uint16_t); -+ uint16_t sum = 0; -+ unsigned char *ptr = (unsigned char *) jm; -+ -+ while (count--) { -+ uint16_t val; - -- assert(count <= sizeof(struct jm_metadata)); -+ memcpy(&val, ptr, sizeof(uint16_t)); -+ sum += le16_to_cpu(val); - -- while (count--) -- sum += *p++; -+ ptr += sizeof(uint16_t); -+ } - -- return !sum || sum == 1; -+ return sum == 0 || sum == 1; - } - - static int probe_jmraid(blkid_probe pr, -@@ -108,9 +111,12 @@ static int probe_jmraid(blkid_probe pr, - if (memcmp(jm->signature, JM_SIGNATURE, sizeof(JM_SIGNATURE) - 1) != 0) - return 1; - -+ if (!jm_checksum(jm)) -+ return 1; -+ - jm_to_cpu(jm); - -- if (!jm_checksum(jm)) -+ if (jm->mode > 5) - return 1; - - if (blkid_probe_sprintf_version(pr, "%u.%u", --- -2.27.0 - diff --git a/backport-libblkid-fix-misaligned-address-in-probe_exfat.patch b/backport-libblkid-fix-misaligned-address-in-probe_exfat.patch deleted file mode 100644 index ae5bec3..0000000 --- a/backport-libblkid-fix-misaligned-address-in-probe_exfat.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 2a71e291d0fe247d7ca62775e47865dda4b2acfd Mon Sep 17 00:00:00 2001 -From: Milan Broz -Date: Thu, 24 Nov 2022 10:54:01 +0100 -Subject: [PATCH] libblkid: fix misaligned-address in probe_exfat - -Value checked in le32_to_cpu() needs to be properly -aligned. Just copy the value temporarily for conversion. - -Fix OSS-Fuzz issue 53696 ---- - libblkid/src/superblocks/exfat.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/libblkid/src/superblocks/exfat.c b/libblkid/src/superblocks/exfat.c -index 323e375..34b7ef3 100644 ---- a/libblkid/src/superblocks/exfat.c -+++ b/libblkid/src/superblocks/exfat.c -@@ -69,16 +69,17 @@ static uint64_t cluster_to_offset(const struct exfat_super_block *sb, - static uint32_t next_cluster(blkid_probe pr, - const struct exfat_super_block *sb, uint32_t cluster) - { -- uint32_t *next; -+ uint32_t *nextp, next; - uint64_t fat_offset; - - fat_offset = block_to_offset(sb, le32_to_cpu(sb->fat_block_start)) - + (uint64_t) cluster * sizeof(cluster); -- next = (uint32_t *) blkid_probe_get_buffer(pr, fat_offset, -+ nextp = (uint32_t *) blkid_probe_get_buffer(pr, fat_offset, - sizeof(uint32_t)); -- if (!next) -+ if (!nextp) - return 0; -- return le32_to_cpu(*next); -+ memcpy(&next, nextp, sizeof(next)); -+ return le32_to_cpu(next); - } - - static struct exfat_entry_label *find_label(blkid_probe pr, --- -2.33.0 - diff --git a/backport-libblkid-hfs-fix-label-use-fuzzing.patch b/backport-libblkid-hfs-fix-label-use-fuzzing.patch deleted file mode 100644 index e0ebeba..0000000 --- a/backport-libblkid-hfs-fix-label-use-fuzzing.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 74e48269ee9a15e230e25d0e3d2e50f5b0ba2b04 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 2 Jun 2022 16:02:54 +0200 -Subject: [PATCH] libblkid: (hfs) fix label use [fuzzing] - -Reported-by: Thibault Guittet -Signed-off-by: Karel Zak ---- - libblkid/src/superblocks/hfs.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/libblkid/src/superblocks/hfs.c b/libblkid/src/superblocks/hfs.c -index 9674b1481f..68cb30edbb 100644 ---- a/libblkid/src/superblocks/hfs.c -+++ b/libblkid/src/superblocks/hfs.c -@@ -173,7 +173,10 @@ static int probe_hfs(blkid_probe pr, const struct blkid_idmag *mag) - - hfs_set_uuid(pr, hfs->finder_info.id, sizeof(hfs->finder_info.id)); - -- blkid_probe_set_label(pr, hfs->label, hfs->label_len); -+ size = hfs->label_len; -+ if ((size_t) size > sizeof(hfs->label)) -+ size = sizeof(hfs->label); -+ blkid_probe_set_label(pr, hfs->label, size); - return 0; - } - diff --git a/backport-libblkid-hfs-fix-make-sure-buffer-is-large-enough.patch b/backport-libblkid-hfs-fix-make-sure-buffer-is-large-enough.patch deleted file mode 100644 index fa07ef8..0000000 --- a/backport-libblkid-hfs-fix-make-sure-buffer-is-large-enough.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 7ebfe9b411c12223a2500ca62d6be37c48e2d83d Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 2 Jun 2022 16:02:54 +0200 -Subject: [PATCH] libblkid: (hfs) fix make sure buffer is large enough - -Signed-off-by: Karel Zak ---- - libblkid/src/superblocks/ntfs.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/libblkid/src/superblocks/ntfs.c b/libblkid/src/superblocks/ntfs.c -index 9f1927cf74..b5799c3e33 100644 ---- a/libblkid/src/superblocks/ntfs.c -+++ b/libblkid/src/superblocks/ntfs.c -@@ -158,6 +158,9 @@ static int __probe_ntfs(blkid_probe pr, const struct blkid_idmag *mag, int save_ - sectors_per_cluster, nr_clusters, - off)); - -+ if (mft_record_size < 4) -+ return 1; -+ - buf_mft = blkid_probe_get_buffer(pr, off, mft_record_size); - if (!buf_mft) - return errno ? -errno : 1; diff --git a/backport-libblkid-mac-make-sure-block-size-is-large-enough-fuzzing.patch b/backport-libblkid-mac-make-sure-block-size-is-large-enough-fuzzing.patch deleted file mode 100644 index acd0a4e..0000000 --- a/backport-libblkid-mac-make-sure-block-size-is-large-enough-fuzzing.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 4e12fbca62be10b09503cecc7507757874043474 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 2 Jun 2022 16:02:54 +0200 -Subject: [PATCH] libblkid: (mac) make sure block size is large enough - [fuzzing] - -Reported-by: Thibault Guittet -Signed-off-by: Karel Zak ---- - libblkid/src/partitions/mac.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/libblkid/src/partitions/mac.c b/libblkid/src/partitions/mac.c -index 092d31d322..75a558b0a3 100644 ---- a/libblkid/src/partitions/mac.c -+++ b/libblkid/src/partitions/mac.c -@@ -93,6 +93,8 @@ static int probe_mac_pt(blkid_probe pr, - } - - block_size = be16_to_cpu(md->block_size); -+ if (block_size < sizeof(struct mac_partition)) -+ goto nothing; - - /* The partition map always begins at physical block 1, - * the second block on the disk. diff --git a/backport-libblkid-make-blkid_free_probe-more-robust.patch b/backport-libblkid-make-blkid_free_probe-more-robust.patch deleted file mode 100644 index 77daf12..0000000 --- a/backport-libblkid-make-blkid_free_probe-more-robust.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 5caa4117b40ea9babf4aee6e8786fb70507ee1b8 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 17 Mar 2022 12:41:48 +0100 -Subject: [PATCH] libblkid: make blkid_free_probe() more robust - -Signed-off-by: Karel Zak ---- - libblkid/src/probe.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c -index 2e0e08ac1d..31706240fc 100644 ---- a/libblkid/src/probe.c -+++ b/libblkid/src/probe.c -@@ -251,6 +251,7 @@ void blkid_free_probe(blkid_probe pr) - if (ch->driver->free_data) - ch->driver->free_data(pr, ch->data); - free(ch->fltr); -+ ch->fltr = NULL; - } - - if ((pr->flags & BLKID_FL_PRIVATE_FD) && pr->fd >= 0) diff --git a/backport-libblkid-nvidia_raid-validate-checksum.patch b/backport-libblkid-nvidia_raid-validate-checksum.patch deleted file mode 100644 index 2915295..0000000 --- a/backport-libblkid-nvidia_raid-validate-checksum.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 8a08c34aad61cb59c977212458bf55f5a81186e8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= -Date: Thu, 2 Mar 2023 15:54:39 +0000 -Subject: [PATCH] libblkid: nvidia_raid: validate checksum -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -See #1843 - -Signed-off-by: Thomas Weißschuh ---- - libblkid/src/superblocks/nvidia_raid.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/libblkid/src/superblocks/nvidia_raid.c b/libblkid/src/superblocks/nvidia_raid.c -index 35c663c8d..f59a0e100 100644 ---- a/libblkid/src/superblocks/nvidia_raid.c -+++ b/libblkid/src/superblocks/nvidia_raid.c -@@ -27,6 +27,14 @@ struct nv_metadata { - #define NVIDIA_SUPERBLOCK_SIZE 120 - - -+static int nvraid_verify_checksum(blkid_probe pr, const struct nv_metadata *nv) -+{ -+ uint32_t csum = le32_to_cpu(nv->chksum); -+ for (size_t i = 0; i < le32_to_cpu(nv->size); i++) -+ csum += le32_to_cpu(((uint32_t *) nv)[i]); -+ return blkid_probe_verify_csum(pr, csum, le32_to_cpu(nv->chksum)); -+} -+ - static int probe_nvraid(blkid_probe pr, - const struct blkid_idmag *mag __attribute__((__unused__))) - { -@@ -42,7 +50,7 @@ static int probe_nvraid(blkid_probe pr, - nv = (struct nv_metadata *) - blkid_probe_get_buffer(pr, - off, -- sizeof(struct nv_metadata)); -+ NVIDIA_SUPERBLOCK_SIZE); - if (!nv) - return errno ? -errno : 1; - -@@ -50,6 +58,8 @@ static int probe_nvraid(blkid_probe pr, - return 1; - if (le32_to_cpu(nv->size) * 4 != NVIDIA_SUPERBLOCK_SIZE) - return 1; -+ if (!nvraid_verify_checksum(pr, nv)) -+ return 1; - if (blkid_probe_sprintf_version(pr, "%u", le16_to_cpu(nv->version)) != 0) - return 1; - if (blkid_probe_set_magic(pr, off, sizeof(nv->vendor), --- -2.27.0 - diff --git a/backport-libblkid-nvidia_raid-verify-superblock-size.patch b/backport-libblkid-nvidia_raid-verify-superblock-size.patch deleted file mode 100644 index 62ea0b5..0000000 --- a/backport-libblkid-nvidia_raid-verify-superblock-size.patch +++ /dev/null @@ -1,38 +0,0 @@ -From d8d164db5ee217034dea7788263b532114bcd2fd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= -Date: Thu, 2 Mar 2023 15:27:58 +0000 -Subject: [PATCH] libblkid: nvidia_raid: verify superblock size -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Thomas Weißschuh ---- - libblkid/src/superblocks/nvidia_raid.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/libblkid/src/superblocks/nvidia_raid.c b/libblkid/src/superblocks/nvidia_raid.c -index 5db8ec260..35c663c8d 100644 ---- a/libblkid/src/superblocks/nvidia_raid.c -+++ b/libblkid/src/superblocks/nvidia_raid.c -@@ -24,6 +24,8 @@ struct nv_metadata { - } __attribute__((packed)); - - #define NVIDIA_SIGNATURE "NVIDIA" -+#define NVIDIA_SUPERBLOCK_SIZE 120 -+ - - static int probe_nvraid(blkid_probe pr, - const struct blkid_idmag *mag __attribute__((__unused__))) -@@ -46,6 +48,8 @@ static int probe_nvraid(blkid_probe pr, - - if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0) - return 1; -+ if (le32_to_cpu(nv->size) * 4 != NVIDIA_SUPERBLOCK_SIZE) -+ return 1; - if (blkid_probe_sprintf_version(pr, "%u", le16_to_cpu(nv->version)) != 0) - return 1; - if (blkid_probe_set_magic(pr, off, sizeof(nv->vendor), --- -2.27.0 - diff --git a/backport-libblkid-probe-fix-size-and-offset-overflows-fuzzing.patch b/backport-libblkid-probe-fix-size-and-offset-overflows-fuzzing.patch deleted file mode 100644 index 58810cb..0000000 --- a/backport-libblkid-probe-fix-size-and-offset-overflows-fuzzing.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 106de261469e1001243d5b81ed895762fb34b2ba Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 2 Jun 2022 16:02:54 +0200 -Subject: [PATCH] libblkid: (probe) fix size and offset overflows [fuzzing] - -Reported-by: Thibault Guittet -Signed-off-by: Karel Zak ---- - libblkid/src/probe.c | 17 ++++++++++++++--- - 1 file changed, 14 insertions(+), 3 deletions(-) - -diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c -index 06c25572be..fc638c9bbe 100644 ---- a/libblkid/src/probe.c -+++ b/libblkid/src/probe.c -@@ -621,6 +621,11 @@ static int hide_buffer(blkid_probe pr, uint64_t off, uint64_t len) - struct list_head *p; - int ct = 0; - -+ if (UINT64_MAX - len < off) { -+ DBG(BUFFER, ul_debug("\t hide-buffer overflow (ignore)")); -+ return -EINVAL; -+ } -+ - list_for_each(p, &pr->buffers) { - struct blkid_bufinfo *x = - list_entry(p, struct blkid_bufinfo, bufs); -@@ -656,14 +661,20 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr, uint64_t off, uint64_t len - DBG(BUFFER, ul_debug("\t>>>> off=%ju, real-off=%ju (probe <%ju..%ju>, len=%ju", - off, real_off, pr->off, pr->off + pr->size, len)); - */ -- - if (pr->size == 0) { - errno = EINVAL; - return NULL; - } - -- if (len == 0 || (!S_ISCHR(pr->mode) && pr->off + pr->size < real_off + len)) { -- DBG(BUFFER, ul_debug("\t ignore: request out of probing area")); -+ if (UINT64_MAX - len < off || UINT64_MAX - len < real_off) { -+ DBG(BUFFER, ul_debug("\t read-buffer overflow (ignore)")); -+ return NULL; -+ } -+ -+ if (len == 0 -+ || (!S_ISCHR(pr->mode) && (pr->size < off || pr->size < len)) -+ || (!S_ISCHR(pr->mode) && (pr->off + pr->size < real_off + len))) { -+ DBG(BUFFER, ul_debug("\t read-buffer out of probing area (ignore)")); - errno = 0; - return NULL; - } diff --git a/backport-libblkid-src-topology-dm-close-redundant-write-file-.patch b/backport-libblkid-src-topology-dm-close-redundant-write-file-.patch deleted file mode 100644 index f385781..0000000 --- a/backport-libblkid-src-topology-dm-close-redundant-write-file-.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 3f5dd5fa812120764312a2326285e88b2be82c2f Mon Sep 17 00:00:00 2001 -From: jiayi0118 <1398871225@qq.com> -Date: Wed, 17 Aug 2022 22:25:27 +0800 -Subject: [PATCH] libblkid/src/topology/dm: close redundant write file - description for pipe before reading data. - -Reference:https://github.com/util-linux/util-linux/commit/1d5d50c277e459f4ccbb6e3db416dcb6eb2e2bc4 -Conflict:NA ---- - libblkid/src/topology/dm.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/libblkid/src/topology/dm.c b/libblkid/src/topology/dm.c -index b210a805b..1a1cb8ac0 100644 ---- a/libblkid/src/topology/dm.c -+++ b/libblkid/src/topology/dm.c -@@ -103,6 +103,10 @@ static int probe_dm_tp(blkid_probe pr, - if (!stream) - goto nothing; - -+ if (dmpipe[1] != -1) { -+ close(dmpipe[1]); -+ } -+ - if (fscanf(stream, "%lld %lld striped %d %d ", - &offset, &size, &stripes, &stripesize) != 0) - goto nothing; -@@ -111,7 +115,6 @@ static int probe_dm_tp(blkid_probe pr, - blkid_topology_set_optimal_io_size(pr, (stripes * stripesize) << 9); - - fclose(stream); -- close(dmpipe[1]); - return 0; - - nothing: -@@ -119,8 +122,6 @@ nothing: - fclose(stream); - else if (dmpipe[0] != -1) - close(dmpipe[0]); -- if (dmpipe[1] != -1) -- close(dmpipe[1]); - return 1; - } - --- -2.31.1 - diff --git a/backport-libblkid-topology-init-variables-for-DM.patch b/backport-libblkid-topology-init-variables-for-DM.patch deleted file mode 100644 index 0cb8601..0000000 --- a/backport-libblkid-topology-init-variables-for-DM.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 819210f37d66949f54fb2f830bc62cb3635a83d5 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Fri, 19 Aug 2022 11:40:27 +0200 -Subject: [PATCH] libblkid: (topology) init variables for DM - -Addresses: https://github.com/util-linux/util-linux/issues/1776 -Signed-off-by: Karel Zak - -Reference:https://github.com/util-linux/util-linux/commit/819210f37d66949f54fb2f830bc62cb3635a83d5 -Conflict:NA ---- - libblkid/src/topology/dm.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libblkid/src/topology/dm.c b/libblkid/src/topology/dm.c -index 1a1cb8ac0..77146e2e2 100644 ---- a/libblkid/src/topology/dm.c -+++ b/libblkid/src/topology/dm.c -@@ -34,10 +34,10 @@ static int probe_dm_tp(blkid_probe pr, - "/usr/sbin/dmsetup", - "/sbin/dmsetup" - }; -- int dmpipe[] = { -1, -1 }, stripes, stripesize; -+ int dmpipe[] = { -1, -1 }, stripes = 0, stripesize = 0; - const char *cmd = NULL; - FILE *stream = NULL; -- long long offset, size; -+ long long offset = 0, size = 0; - size_t i; - dev_t devno = blkid_probe_get_devno(pr); - --- -2.31.1 - diff --git a/backport-libblkid-use-checksum-for-jmicron.patch b/backport-libblkid-use-checksum-for-jmicron.patch deleted file mode 100644 index f4e0eed..0000000 --- a/backport-libblkid-use-checksum-for-jmicron.patch +++ /dev/null @@ -1,122 +0,0 @@ -From cf68e2c897a29f8a3a1c8402574bbb49adf5a52a Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 19 Oct 2022 11:16:17 +0200 -Subject: [PATCH] libblkid: use checksum for jmicron - -Addresses: https://github.com/util-linux/util-linux/pull/1843 -Signed-off-by: Karel Zak ---- - libblkid/src/superblocks/jmicron_raid.c | 83 ++++++++++++++++++++++--- - 1 file changed, 74 insertions(+), 9 deletions(-) - -diff --git a/libblkid/src/superblocks/jmicron_raid.c b/libblkid/src/superblocks/jmicron_raid.c -index ca7986733..9ef8cd3f8 100644 ---- a/libblkid/src/superblocks/jmicron_raid.c -+++ b/libblkid/src/superblocks/jmicron_raid.c -@@ -16,14 +16,75 @@ - - #include "superblocks.h" - -+#define JM_SIGNATURE "JM" -+#define JM_MINOR_VERSION(_x) ((_x)->version & 0xFF) -+#define JM_MAJOR_VERSION(_x) ((_x)->version >> 8) -+#define JM_SPARES 2 -+#define JM_MEMBERS 8 -+ - struct jm_metadata { -- int8_t signature[2]; -- uint8_t minor_version; -- uint8_t major_version; -- uint16_t checksum; --}; -+ int8_t signature[2]; /* 0x0 - 0x01 */ - --#define JM_SIGNATURE "JM" -+ uint16_t version; /* 0x03 - 0x04 JMicron version */ -+ -+ uint16_t checksum; /* 0x04 - 0x05 */ -+ uint8_t filler[10]; -+ -+ uint32_t identity; /* 0x10 - 0x13 */ -+ -+ struct { -+ uint32_t base; /* 0x14 - 0x17 */ -+ uint32_t range; /* 0x18 - 0x1B range */ -+ uint16_t range2; /* 0x1C - 0x1D range2 */ -+ } segment; -+ -+ int8_t name[16]; /* 0x20 - 0x2F */ -+ -+ uint8_t mode; /* 0x30 RAID level */ -+ uint8_t block; /* 0x31 stride size (2=4K, 3=8K, ...) */ -+ uint16_t attribute; /* 0x32 - 0x33 */ -+ uint8_t filler1[4]; -+ -+ uint32_t spare[JM_SPARES]; /* 0x38 - 0x3F */ -+ uint32_t member[JM_MEMBERS]; /* 0x40 - 0x5F */ -+ -+ uint8_t filler2[0x20]; -+} __attribute__ ((packed)); -+ -+static void jm_to_cpu(struct jm_metadata *jm) -+{ -+ unsigned int i; -+ -+ le16_to_cpu(jm->version); -+ le16_to_cpu(jm->checksum); -+ le32_to_cpu(jm->identity); -+ -+ le32_to_cpu(jm->segment.base); -+ le32_to_cpu(jm->segment.range); -+ le16_to_cpu(jm->segment.range2); -+ -+ le16_to_cpu(jm->attribute); -+ -+ for (i = 0; i < JM_SPARES; i++) -+ le32_to_cpu(jm->spare[i]); -+ -+ for (i = 0; i < JM_MEMBERS; i++) -+ le32_to_cpu(jm->member[i]); -+} -+ -+static int jm_checksum(struct jm_metadata *jm) -+{ -+ size_t count = 64; -+ char *buf = (char *) jm; -+ uint16_t *p = (uint16_t *) buf, sum = 0; -+ -+ assert(count <= sizeof(struct jm_metadata)); -+ -+ while (count--) -+ sum += *p++; -+ -+ return !sum || sum == 1; -+} - - static int probe_jmraid(blkid_probe pr, - const struct blkid_idmag *mag __attribute__((__unused__))) -@@ -46,8 +107,14 @@ static int probe_jmraid(blkid_probe pr, - - if (memcmp(jm->signature, JM_SIGNATURE, sizeof(JM_SIGNATURE) - 1) != 0) - return 1; -+ -+ jm_to_cpu(jm); -+ -+ if (!jm_checksum(jm)) -+ return 1; -+ - if (blkid_probe_sprintf_version(pr, "%u.%u", -- jm->major_version, jm->minor_version) != 0) -+ JM_MAJOR_VERSION(jm), JM_MINOR_VERSION(jm)) != 0) - return 1; - if (blkid_probe_set_magic(pr, off, sizeof(jm->signature), - (unsigned char *) jm->signature)) -@@ -61,5 +128,3 @@ const struct blkid_idinfo jmraid_idinfo = { - .probefunc = probe_jmraid, - .magics = BLKID_NONE_MAGIC - }; -- -- --- -2.27.0 - diff --git a/backport-libfdisk-Fix-randomly-generated-GPT-UUID-s.patch b/backport-libfdisk-Fix-randomly-generated-GPT-UUID-s.patch deleted file mode 100644 index 401c1e2..0000000 --- a/backport-libfdisk-Fix-randomly-generated-GPT-UUID-s.patch +++ /dev/null @@ -1,62 +0,0 @@ -From dd405ea745e451fb0cf32e9dedd94d69850fe333 Mon Sep 17 00:00:00 2001 -From: Toomas Losin -Date: Sun, 5 Mar 2023 15:57:55 -0800 -Subject: [PATCH] libfdisk: Fix randomly generated GPT UUID's - -Fdisk commands that create random GPT UUID's result in values that are -not UEFI-compliant being written to disk: The "g" command creates a -new GPT whose in-core DiskGUID value is entirely big-endian; the "n" -command creates a GPT partition whose in-core UniquePartitionGUID -value is entirely big-endian. Those big-endian values are written to -disk by the "w" command rather than the mix of little- and big-endian -spec'd by UEFI. - -This was caused by a libfdisk patch in 2017 that was addressing -warnings about "taking address of packed member". Reading gpt.c finds -two instances of dead code which suggests that perhaps there was some -confusion between a struct and a pointer to a struct. The intent must -have been to convert the randomly generated big-endian RFC 4122 UUID -values to UEFI's mixed-endian but the confusion(?) resulted in some -dead code and non-conversion of the UUID's. - -This patch corrects the breakage while still avoiding "taking address -of packed member" warnings. The "w" command will once again write -UEFI-compliant values to disk. - -Fixes: 92e486f80ef8 ("libfdisk: fix guid usage of packed struct gpt_entry") -Signed-off-by: Toomas Losin ---- - libfdisk/src/gpt.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c -index d7b3e1c70..c3c0347cb 100644 ---- a/libfdisk/src/gpt.c -+++ b/libfdisk/src/gpt.c -@@ -878,9 +878,9 @@ static int gpt_mknew_header(struct fdisk_context *cxt, - if (!has_id) { - struct gpt_guid guid; - -- uuid_generate_random((unsigned char *) &header->disk_guid); -- guid = header->disk_guid; -+ uuid_generate_random((unsigned char *) &guid); - swap_efi_guid(&guid); -+ header->disk_guid = guid; - } - return 0; - } -@@ -2621,9 +2621,9 @@ static int gpt_add_partition( - */ - struct gpt_guid guid; - -- uuid_generate_random((unsigned char *) &e->partition_guid); -- guid = e->partition_guid; -+ uuid_generate_random((unsigned char *) &guid); - swap_efi_guid(&guid); -+ e->partition_guid = guid; - } - - if (pa && pa->name && *pa->name) --- -2.27.0 - diff --git a/backport-libfdisk-check-calloc-return-gcc-analyzer.patch b/backport-libfdisk-check-calloc-return-gcc-analyzer.patch deleted file mode 100644 index d3ba60f..0000000 --- a/backport-libfdisk-check-calloc-return-gcc-analyzer.patch +++ /dev/null @@ -1,43 +0,0 @@ -From e31e28848e7e5887b0dd48f5bb5ce3c8055eee1e Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 18 Aug 2021 11:35:07 +0200 -Subject: [PATCH] libfdisk: check calloc() return [gcc-analyzer] - -Signed-off-by: Karel Zak ---- - libfdisk/src/ask.c | 4 ++++ - libfdisk/src/item.c | 3 +++ - 2 files changed, 7 insertions(+) - -diff --git a/libfdisk/src/ask.c b/libfdisk/src/ask.c -index 31f95fb..274f6ba 100644 ---- a/libfdisk/src/ask.c -+++ b/libfdisk/src/ask.c -@@ -36,6 +36,10 @@ int fdisk_set_ask(struct fdisk_context *cxt, - struct fdisk_ask *fdisk_new_ask(void) - { - struct fdisk_ask *ask = calloc(1, sizeof(struct fdisk_ask)); -+ -+ if (!ask) -+ return NULL; -+ - DBG(ASK, ul_debugobj(ask, "alloc")); - ask->refcount = 1; - return ask; -diff --git a/libfdisk/src/item.c b/libfdisk/src/item.c -index 86fa0fb..671f9ad 100644 ---- a/libfdisk/src/item.c -+++ b/libfdisk/src/item.c -@@ -40,6 +40,9 @@ struct fdisk_labelitem *fdisk_new_labelitem(void) - { - struct fdisk_labelitem *li = calloc(1, sizeof(*li)); - -+ if (!li) -+ return NULL; -+ - li->refcount = 1; - DBG(ITEM, ul_debugobj(li, "alloc")); - return li; --- -1.8.3.1 - diff --git a/backport-libfdisk-dereference-of-possibly-NULL-gcc-analyzer.patch b/backport-libfdisk-dereference-of-possibly-NULL-gcc-analyzer.patch deleted file mode 100644 index c072b08..0000000 --- a/backport-libfdisk-dereference-of-possibly-NULL-gcc-analyzer.patch +++ /dev/null @@ -1,27 +0,0 @@ -From fb1689c1de5fdc945c599aa46b483fa5e1333935 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 18 Aug 2021 11:15:55 +0200 -Subject: [PATCH] libfdisk: dereference of possibly-NULL [gcc-analyzer] - -Signed-off-by: Karel Zak ---- - libfdisk/src/parttype.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/libfdisk/src/parttype.c b/libfdisk/src/parttype.c -index 3a5db9c..271b671 100644 ---- a/libfdisk/src/parttype.c -+++ b/libfdisk/src/parttype.c -@@ -26,6 +26,9 @@ struct fdisk_parttype *fdisk_new_parttype(void) - { - struct fdisk_parttype *t = calloc(1, sizeof(*t)); - -+ if (!t) -+ return NULL; -+ - t->refcount = 1; - t->flags = FDISK_PARTTYPE_ALLOCATED; - DBG(PARTTYPE, ul_debugobj(t, "alloc")); --- -1.8.3.1 - diff --git a/backport-libmount-all-continue-although-proc-is-not-mounted.patch b/backport-libmount-all-continue-although-proc-is-not-mounted.patch deleted file mode 100644 index 501681e..0000000 --- a/backport-libmount-all-continue-although-proc-is-not-mounted.patch +++ /dev/null @@ -1,113 +0,0 @@ -From b8f2fce2a20944cd8b1a7e91dfa04f9725ec3eb8 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 18 Nov 2021 11:47:08 +0100 -Subject: [PATCH] libmount: (--all) continue although /proc is not mounted - -Now 'mount --all' ends with error if /proc is not mounted and there is -some other entry before /proc in fstab. This commit improves this -situation and ignores all mount table related errors if the table is -empty. - -This is important for situation when there is for example "/" as the -first line in fstab. - -Addresses: https://github.com/util-linux/util-linux/issues/1492 -Signed-off-by: Karel Zak ---- - libmount/src/context.c | 25 +++++++++++++++++-------- - libmount/src/context_mount.c | 9 ++++++++- - sys-utils/mount.8.adoc | 2 ++ - 3 files changed, 27 insertions(+), 9 deletions(-) - -diff --git a/libmount/src/context.c b/libmount/src/context.c -index 3b32224..bd215c0 100644 ---- a/libmount/src/context.c -+++ b/libmount/src/context.c -@@ -1298,6 +1298,16 @@ int mnt_context_get_mtab(struct libmnt_context *cxt, struct libmnt_table **tb) - cxt->table_fltrcb_data); - - mnt_table_set_cache(cxt->mtab, mnt_context_get_cache(cxt)); -+ } -+ -+ /* Read the table; it's empty, because this first mnt_context_get_mtab() -+ * call, or because /proc was not accessible in previous calls */ -+ if (mnt_table_is_empty(cxt->mtab)) { -+ if (!ns_old) { -+ ns_old = mnt_context_switch_target_ns(cxt); -+ if (!ns_old) -+ return -MNT_ERR_NAMESPACE; -+ } - - /* - * Note that mtab_path is NULL if mtab is useless or unsupported -@@ -2874,7 +2884,7 @@ int mnt_context_is_fs_mounted(struct libmnt_context *cxt, - struct libmnt_fs *fs, int *mounted) - { - struct libmnt_table *mtab, *orig; -- int rc; -+ int rc = 0; - struct libmnt_ns *ns_old; - - if (!cxt || !fs || !mounted) -@@ -2893,18 +2903,17 @@ int mnt_context_is_fs_mounted(struct libmnt_context *cxt, - cxt->mtab = NULL; - } - *mounted = 0; -- return 0; /* /proc not mounted */ -- } -+ rc = 0; /* /proc not mounted */ - -- if (rc) -- return rc; -- -- *mounted = __mnt_table_is_fs_mounted(mtab, fs, -+ } else if (rc == 0) { -+ *mounted = __mnt_table_is_fs_mounted(mtab, fs, - mnt_context_get_target_prefix(cxt)); - -+ } -+ - if (!mnt_context_switch_ns(cxt, ns_old)) - return -MNT_ERR_NAMESPACE; -- return 0; -+ return rc; - } - - static int mnt_context_add_child(struct libmnt_context *cxt, pid_t pid) -diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c -index 55ebf79..f9bedd2 100644 ---- a/libmount/src/context_mount.c -+++ b/libmount/src/context_mount.c -@@ -1397,8 +1397,15 @@ int mnt_context_next_mount(struct libmnt_context *cxt, - - /* ignore already mounted filesystems */ - rc = mnt_context_is_fs_mounted(cxt, *fs, &mounted); -- if (rc) -+ if (rc) { -+ if (mnt_table_is_empty(cxt->mtab)) { -+ DBG(CXT, ul_debugobj(cxt, "next-mount: no mount table [rc=%d], ignore", rc)); -+ rc = 0; -+ if (ignored) -+ *ignored = 1; -+ } - return rc; -+ } - if (mounted) { - if (ignored) - *ignored = 2; -diff --git a/sys-utils/mount.8.adoc b/sys-utils/mount.8.adoc -index 6e72d48..e8f0c36 100644 ---- a/sys-utils/mount.8.adoc -+++ b/sys-utils/mount.8.adoc -@@ -301,6 +301,8 @@ Command-line options available for the *mount* command are: - *-a*, *--all*:: - Mount all filesystems (of the given types) mentioned in _fstab_ (except for those whose line contains the *noauto* keyword). The filesystems are mounted following their order in _fstab_. The *mount* command compares filesystem source, target (and fs root for bind mount or btrfs) to detect already mounted filesystems. The kernel table with already mounted filesystems is cached during *mount --all*. This means that all duplicated _fstab_ entries will be mounted. - + -+The correct functionality depends on /proc (to detect already mounted filesystems) and on /sys (to evaluate filesystem tags like UUID= or LABEL=). It's strongly recommended to mount /proc and /sys filesystems before *mount -a* is executed, or keep /proc and /sys at the beginning of fstab. -++ - The option *--all* is possible to use for remount operation too. In this case all filters (*-t* and *-O*) are applied to the table of already mounted filesystems. - + - Since version 2.35 is possible to use the command line option *-o* to alter mount options from _fstab_ (see also *--options-mode*). --- -2.27.0 - diff --git a/backport-libmount-fix-possible-memory-leak-in-mnt_optstr_fix_secontext-coverity-scan.patch b/backport-libmount-fix-possible-memory-leak-in-mnt_optstr_fix_secontext-coverity-scan.patch deleted file mode 100644 index b7d6df5..0000000 --- a/backport-libmount-fix-possible-memory-leak-in-mnt_optstr_fix_secontext-coverity-scan.patch +++ /dev/null @@ -1,37 +0,0 @@ -ssFrom fbc09df31a1f89b02ae13b21c949728ad82f5713 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 17 Mar 2022 13:00:44 +0100 -Subject: [PATCH] libmount: fix possible memory leak in - mnt_optstr_fix_secontext() [coverity scan] - -Signed-off-by: Karel Zak ---- - libmount/src/optstr.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c -index 16800f5..97fd6da 100644 ---- a/libmount/src/optstr.c -+++ b/libmount/src/optstr.c -@@ -908,12 +908,16 @@ int mnt_optstr_fix_secontext(char **optstr, - - /* create a quoted string from the raw context */ - sz = strlen((char *) raw); -- if (!sz) -+ if (!sz) { -+ freecon(raw); - return -EINVAL; -+ } - - p = val = malloc(valsz + 3); -- if (!val) -+ if (!val) { -+ freecon(raw); - return -ENOMEM; -+ } - - *p++ = '"'; - memcpy(p, raw, sz); --- -2.27.0 - diff --git a/backport-llib-pty-session-split-PTY-and-signalfd-setup.patch b/backport-llib-pty-session-split-PTY-and-signalfd-setup.patch deleted file mode 100644 index d72e64d..0000000 --- a/backport-llib-pty-session-split-PTY-and-signalfd-setup.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 4681d88ba1034d488814bbbb6e7d06d17e33322d Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 16 Nov 2022 09:17:52 +0100 -Subject: [PATCH] llib/pty-session: split PTY and signalfd setup - -In some cases applications need to use PTY before signalfd is enabled. - -Signed-off-by: Karel Zak ---- - include/pty-session.h | 1 + - lib/pty-session.c | 29 +++++++++++++++++++++++++---- - login-utils/su-common.c | 2 ++ - term-utils/scriptlive.c | 2 ++ - 4 files changed, 30 insertions(+), 4 deletions(-) - -diff --git a/include/pty-session.h b/include/pty-session.h -index 09eff43..3242992 100644 ---- a/include/pty-session.h -+++ b/include/pty-session.h -@@ -98,6 +98,7 @@ void ul_pty_set_child(struct ul_pty *pty, pid_t child); - struct ul_pty_callbacks *ul_pty_get_callbacks(struct ul_pty *pty); - int ul_pty_is_running(struct ul_pty *pty); - int ul_pty_setup(struct ul_pty *pty); -+int ul_pty_signals_setup(struct ul_pty *pty); - void ul_pty_cleanup(struct ul_pty *pty); - int ul_pty_chownmod_slave(struct ul_pty *pty, uid_t uid, gid_t gid, mode_t mode); - void ul_pty_init_slave(struct ul_pty *pty); -diff --git a/lib/pty-session.c b/lib/pty-session.c -index 6f038e1..d89dfbb 100644 ---- a/lib/pty-session.c -+++ b/lib/pty-session.c -@@ -149,12 +149,12 @@ static void pty_signals_cleanup(struct ul_pty *pty) - int ul_pty_setup(struct ul_pty *pty) - { - struct termios attrs; -- sigset_t ourset; - int rc = 0; - - assert(pty->sigfd == -1); - -- /* save the current signals setting */ -+ /* save the current signals setting (to make ul_pty_cleanup() usable, -+ * otherwise see ul_pty_signals_setup() */ - sigprocmask(0, NULL, &pty->orgsig); - - if (pty->isterm) { -@@ -198,6 +198,26 @@ int ul_pty_setup(struct ul_pty *pty) - tcsetattr(pty->slave, TCSANOW, &attrs); - } - -+done: -+ if (rc) -+ ul_pty_cleanup(pty); -+ -+ DBG(SETUP, ul_debugobj(pty, "pty setup done [master=%d, slave=%d, rc=%d]", -+ pty->master, pty->slave, rc)); -+ return rc; -+} -+ -+/* call me before fork() */ -+int ul_pty_signals_setup(struct ul_pty *pty) -+{ -+ sigset_t ourset; -+ int rc = 0; -+ -+ assert(pty->sigfd == -1); -+ -+ /* save the current signals setting */ -+ sigprocmask(0, NULL, &pty->orgsig); -+ - sigfillset(&ourset); - if (sigprocmask(SIG_BLOCK, &ourset, NULL)) { - rc = -errno; -@@ -221,8 +241,7 @@ done: - if (rc) - ul_pty_cleanup(pty); - -- DBG(SETUP, ul_debugobj(pty, "pty setup done [master=%d, slave=%d, rc=%d]", -- pty->master, pty->slave, rc)); -+ DBG(SETUP, ul_debugobj(pty, "pty signals setup done [rc=%d]", rc)); - return rc; - } - -@@ -692,6 +711,8 @@ int main(int argc, char *argv[]) - - if (ul_pty_setup(pty)) - err(EXIT_FAILURE, "failed to create pseudo-terminal"); -+ if (ul_pty_signals_setup(pty)) -+ err(EXIT_FAILURE, "failed to initialize signals handler"); - - fflush(stdout); /* ??? */ - -diff --git a/login-utils/su-common.c b/login-utils/su-common.c -index afd0ea8..46dc116 100644 ---- a/login-utils/su-common.c -+++ b/login-utils/su-common.c -@@ -536,6 +536,8 @@ static void create_watching_parent(struct su_context *su) - /* create pty */ - if (ul_pty_setup(su->pty)) - err(EXIT_FAILURE, _("failed to create pseudo-terminal")); -+ if (ul_pty_signals_setup(su->pty)) -+ err(EXIT_FAILURE, _("failed to initialize signals handler")); - } - #endif - fflush(stdout); /* ??? */ -diff --git a/term-utils/scriptlive.c b/term-utils/scriptlive.c -index d81712d..3e68f3c 100644 ---- a/term-utils/scriptlive.c -+++ b/term-utils/scriptlive.c -@@ -294,6 +294,8 @@ main(int argc, char *argv[]) - - if (ul_pty_setup(ss.pty)) - err(EXIT_FAILURE, _("failed to create pseudo-terminal")); -+ if (ul_pty_signals_setup(ss.pty)) -+ err(EXIT_FAILURE, _("failed to initialize signals handler")); - - fflush(stdout); /* ??? */ - --- -2.27.0 - diff --git a/backport-logger-always-update-header-when-read-from-stdin.patch b/backport-logger-always-update-header-when-read-from-stdin.patch deleted file mode 100644 index d0571e8..0000000 --- a/backport-logger-always-update-header-when-read-from-stdin.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 96ccdc00e1fcf1684f9734a189baf90e00ff0c9a Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 1 Nov 2022 10:30:06 +0100 -Subject: [PATCH] logger: always update header when read from stdin - -The current code updates the header only when the priority has been -changed. It's incorrect because wanted is a valid header or each entry -(don't forget that logger for stdin use-case is used in pipe to log -long-time running processes). - -This patch also fixes the initial timestamp; it was originally generated -on logger startup, it now generates the header on the first message. - -$ (sleep 2; date; sleep 2; date; sleep 2; date) | logger --stderr --no-act - -old: -<13>Nov 1 10:42:14 kzak: Tue Nov 1 10:42:16 AM CET 2022 -<13>Nov 1 10:42:14 kzak: Tue Nov 1 10:42:18 AM CET 2022 -<13>Nov 1 10:42:14 kzak: Tue Nov 1 10:42:20 AM CET 2022 - -new: -<13>Nov 1 10:19:02 kzak: Tue Nov 1 10:19:02 AM CET 2022 -<13>Nov 1 10:19:04 kzak: Tue Nov 1 10:19:04 AM CET 2022 -<13>Nov 1 10:19:06 kzak: Tue Nov 1 10:19:06 AM CET 2022 - -Fixes: https://github.com/util-linux/util-linux/issues/1866 -Signed-off-by: Karel Zak ---- - misc-utils/logger.c | 18 +++++++----------- - 1 file changed, 7 insertions(+), 11 deletions(-) - -diff --git a/misc-utils/logger.c b/misc-utils/logger.c -index a29b9e4..0f2a849 100644 ---- a/misc-utils/logger.c -+++ b/misc-utils/logger.c -@@ -920,8 +920,6 @@ static void logger_open(struct logger_ctl *ctl) - ctl->tag = xgetlogin(); - if (!ctl->tag) - ctl->tag = ""; -- -- generate_syslog_header(ctl); - } - - /* re-open; usually after failed connection */ -@@ -971,10 +969,8 @@ static void logger_stdin(struct logger_ctl *ctl) - { - /* note: we re-generate the syslog header for each log message to - * update header timestamps and to reflect possible priority changes. -- * The initial header is generated by logger_open(). - */ - int default_priority = ctl->pri; -- int last_pri = default_priority; - char *buf = xmalloc(ctl->max_message_size + 2 + 2); - int pri; - int c; -@@ -1001,10 +997,6 @@ static void logger_stdin(struct logger_ctl *ctl) - } else - ctl->pri = default_priority; - -- if (ctl->pri != last_pri) { -- generate_syslog_header(ctl); -- last_pri = ctl->pri; -- } - if (c != EOF && c != '\n') - c = getchar(); - } -@@ -1015,8 +1007,10 @@ static void logger_stdin(struct logger_ctl *ctl) - } - buf[i] = '\0'; - -- if (i > 0 || !ctl->skip_empty_lines) -+ if (i > 0 || !ctl->skip_empty_lines) { -+ generate_syslog_header(ctl); - write_output(ctl, buf); -+ } - - if (c == '\n') /* discard line terminator */ - c = getchar(); -@@ -1291,12 +1285,14 @@ int main(int argc, char **argv) - abort(); - } - logger_open(&ctl); -- if (0 < argc) -+ if (0 < argc) { -+ generate_syslog_header(&ctl); - logger_command_line(&ctl, argv); -- else -+ } else - /* Note. --file reopens stdin making the below - * function to be used for file inputs. */ - logger_stdin(&ctl); -+ - logger_close(&ctl); - return EXIT_SUCCESS; - } --- -2.27.0 - diff --git a/backport-logger-fix-prio-prefix-doesn-t-use-priority-default.patch b/backport-logger-fix-prio-prefix-doesn-t-use-priority-default.patch deleted file mode 100644 index 1d6e64d..0000000 --- a/backport-logger-fix-prio-prefix-doesn-t-use-priority-default.patch +++ /dev/null @@ -1,37 +0,0 @@ -From dbe693413205ba2c3d06a42e85b47b1bd713bfee Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 16 Sep 2021 12:20:25 +0200 -Subject: [PATCH] logger: fix --prio-prefix doesn't use --priority default - -The commit b9ef27f have added priority check, but it introduced -regression as the default priority (as specified by --priority) is -ignored. - -This patch fixes this problem, but it also removes extra check for -"kern facility", it's unnecessary and inconsistent with the rest of -logger. - -Fixes: https://github.com/karelzak/util-linux/issues/1450 -Signed-off-by: Karel Zak ---- - misc-utils/logger.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/misc-utils/logger.c b/misc-utils/logger.c -index 5b122de..0e7ac8d 100644 ---- a/misc-utils/logger.c -+++ b/misc-utils/logger.c -@@ -997,8 +997,8 @@ static void logger_stdin(struct logger_ctl *ctl) - if (c == '>' && 0 <= pri && pri <= 191) { - /* valid RFC PRI values */ - i = 0; -- if (pri < 8) /* kern facility is forbidden */ -- pri |= 8; -+ if ((pri & LOG_FACMASK) == 0) -+ pri |= (default_priority & LOG_FACMASK); - ctl->pri = pri; - } else - ctl->pri = default_priority; --- -1.8.3.1 - diff --git a/backport-login-Restore-tty-size-after-calling-vhangup.patch b/backport-login-Restore-tty-size-after-calling-vhangup.patch deleted file mode 100644 index 530d35a..0000000 --- a/backport-login-Restore-tty-size-after-calling-vhangup.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 7ba741a50a04e8e72861e90132394996f2d82006 Mon Sep 17 00:00:00 2001 -From: Daan De Meyer -Date: Sat, 30 Oct 2021 15:56:14 +0100 -Subject: [PATCH] login: Restore tty size after calling vhangup() - -If login receives the tty to work on via stdin, stdout and stderr, -login might end up closing the remaining open file descriptors to -the tty just before it calls vhangup(). When the last open file -descriptors to a tty are closed, it's configured size is reset to -0x0. To avoid this from happening, save the size before closing -the stdin, stdout and stderr file descriptors and reapply the size -after the tty is re-opened. - -Fixes #1484 ---- - login-utils/login.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/login-utils/login.c b/login-utils/login.c -index 3657f04..c9f6d59 100644 ---- a/login-utils/login.c -+++ b/login-utils/login.c -@@ -513,6 +513,7 @@ static void init_tty(struct login_context *cxt) - { - struct stat st; - struct termios tt, ttt; -+ struct winsize ws; - - cxt->tty_mode = (mode_t) getlogindefs_num("TTYPERM", TTY_MODE); - -@@ -543,6 +544,12 @@ static void init_tty(struct login_context *cxt) - } - #endif - -+ /* The TTY size might be reset to 0x0 by the kernel when we close the stdin/stdout/stderr file -+ * descriptors so let's save the size now so we can reapply it later */ -+ memset(&ws, 0, sizeof(struct winsize)); -+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) < 0) -+ syslog(LOG_WARNING, _("TIOCGWINSZ ioctl failed: %m")); -+ - tcgetattr(0, &tt); - ttt = tt; - ttt.c_cflag &= ~HUPCL; -@@ -574,6 +581,11 @@ static void init_tty(struct login_context *cxt) - - /* restore tty modes */ - tcsetattr(0, TCSAFLUSH, &tt); -+ -+ /* Restore tty size */ -+ if (ws.ws_row > 0 || ws.ws_col > 0) -+ if (ioctl(STDIN_FILENO, TIOCSWINSZ, &ws) < 0) -+ syslog(LOG_WARNING, _("TIOCSWINSZ ioctl failed: %m")); - } - - /* --- -1.8.3.1 - diff --git a/backport-login-never-send-signals-to-init.patch b/backport-login-never-send-signals-to-init.patch deleted file mode 100644 index 6529e85..0000000 --- a/backport-login-never-send-signals-to-init.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 4bbda92cdd0ceacc982f759d97d35b1617a8beba Mon Sep 17 00:00:00 2001 -From: Samanta Navarro -Date: Wed, 11 Jan 2023 11:57:21 +0000 -Subject: [PATCH] login: never send signals to init - -If the signal handler is triggered after a failed fork attempt, then -child_pid will be -1. This in turn leads to a positive test and a -subsequent call of kill(1, signal). If signal was SIGTERM, then there -will be also another kill(1, SIGHUP) call. - -Test explicitly for a positive child_pid value to prevent these cases. - -Signed-off-by: Samanta Navarro ---- - login-utils/login.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/login-utils/login.c b/login-utils/login.c -index 2c146b977..74bdf38a4 100644 ---- a/login-utils/login.c -+++ b/login-utils/login.c -@@ -203,12 +203,12 @@ static void timedout(int sig __attribute__((__unused__))) - */ - static void sig_handler(int signal) - { -- if (child_pid) -+ if (child_pid > 0) { - kill(-child_pid, signal); -- else -+ if (signal == SIGTERM) -+ kill(-child_pid, SIGHUP); /* because the shell often ignores SIGTERM */ -+ } else - got_sig = 1; -- if (signal == SIGTERM) -- kill(-child_pid, SIGHUP); /* because the shell often ignores SIGTERM */ - } - - /* --- -2.27.0 - diff --git a/backport-loopdev-set-block_size-when-using-LOOP_CONFIGURE.patch b/backport-loopdev-set-block_size-when-using-LOOP_CONFIGURE.patch deleted file mode 100644 index 16ca38c..0000000 --- a/backport-loopdev-set-block_size-when-using-LOOP_CONFIGURE.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 854abba0dd9b45b4f40a9c934694b3f14052eceb Mon Sep 17 00:00:00 2001 -From: Hideki EIRAKU -Date: Wed, 25 May 2022 12:23:16 +0900 -Subject: [PATCH] loopdev: set block_size when using LOOP_CONFIGURE - -LOOP_CONFIGURE ioctl was introduced by commit -d5fd456c88aba4fcf77d35fe38024a8d5c814686. Since the previous -implementation set partscan flag but did not set block_size with the -LOOP_CONFIGURE ioctl, an issue fixed by commit -422f0e9f206a145c59a71333dad20d38cbbfc0c4 was reappeared. Setting -block_size in the LOOP_CONFIGURE ioctl parameter fixes the issue. - -Signed-off-by: Hideki EIRAKU ---- - lib/loopdev.c | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -diff --git a/lib/loopdev.c b/lib/loopdev.c -index d9ea1d4..0afe300 100644 ---- a/lib/loopdev.c -+++ b/lib/loopdev.c -@@ -1357,6 +1357,9 @@ int loopcxt_setup_device(struct loopdev_cxt *lc) - * -- since Linux v5.8-rc1, commit 3448914e8cc550ba792d4ccc74471d1ca4293aae - */ - lc->config.fd = file_fd; -+ if (lc->blocksize > 0) -+ lc->config.block_size = lc->blocksize; -+ - if (ioctl(dev_fd, LOOP_CONFIGURE, &lc->config) < 0) { - rc = -errno; - errsv = errno; -@@ -1366,11 +1369,6 @@ int loopcxt_setup_device(struct loopdev_cxt *lc) - } - fallback = 1; - } else { -- if (lc->blocksize > 0 -- && (rc = loopcxt_ioctl_blocksize(lc, lc->blocksize)) < 0) { -- errsv = -rc; -- goto err; -- } - DBG(SETUP, ul_debugobj(lc, "LOOP_CONFIGURE: OK")); - } - --- -2.27.0 - diff --git a/backport-losetup-fix-memory-leak-asan.patch b/backport-losetup-fix-memory-leak-asan.patch deleted file mode 100644 index 9371238..0000000 --- a/backport-losetup-fix-memory-leak-asan.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 01dd2838b4f60888fc66ccb9aa0f44907d1851a4 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 8 Mar 2022 13:06:45 +0100 -Subject: [PATCH] losetup: fix memory leak [asan] - -Signed-off-by: Karel Zak ---- - sys-utils/losetup.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c -index 09c028b6b4..1d81b117ac 100644 ---- a/sys-utils/losetup.c -+++ b/sys-utils/losetup.c -@@ -239,7 +239,7 @@ static int set_scols_data(struct loopdev_cxt *lc, struct libscols_line *ln) - p = loopcxt_get_device(lc); - break; - case COL_BACK_FILE: -- p = loopcxt_get_backing_file(lc); -+ np = loopcxt_get_backing_file(lc); - break; - case COL_OFFSET: - if (loopcxt_get_offset(lc, &x) == 0) diff --git a/backport-lsblk-fix-endless-loop-if-device-specified-more-than-once.patch b/backport-lsblk-fix-endless-loop-if-device-specified-more-than-once.patch deleted file mode 100644 index e6eb26d..0000000 --- a/backport-lsblk-fix-endless-loop-if-device-specified-more-than-once.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 9eb31ca7f7971101846bd3668be5d7807200fa2f Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 19 Sep 2022 14:23:25 +0200 -Subject: [PATCH] lsblk: fix endless loop if device specified more than once - -Fixes: https://github.com/util-linux/util-linux/issues/1814 -Signed-off-by: Karel Zak ---- - misc-utils/lsblk-devtree.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -diff --git a/misc-utils/lsblk-devtree.c b/misc-utils/lsblk-devtree.c -index ce9d3e84f7..6f9dc54b3c 100644 ---- a/misc-utils/lsblk-devtree.c -+++ b/misc-utils/lsblk-devtree.c -@@ -282,8 +282,25 @@ void lsblk_unref_devtree(struct lsblk_devtree *tr) - } - } - -+static int has_root(struct lsblk_devtree *tr, struct lsblk_device *dev) -+{ -+ struct lsblk_iter itr; -+ struct lsblk_device *x = NULL; -+ -+ lsblk_reset_iter(&itr, LSBLK_ITER_FORWARD); -+ -+ while (lsblk_devtree_next_root(tr, &itr, &x) == 0) { -+ if (x == dev) -+ return 1; -+ } -+ return 0; -+} -+ - int lsblk_devtree_add_root(struct lsblk_devtree *tr, struct lsblk_device *dev) - { -+ if (has_root(tr, dev)) -+ return 0; -+ - if (!lsblk_devtree_has_device(tr, dev)) - lsblk_devtree_add_device(tr, dev); - diff --git a/backport-lscpu-fix-p-output-all-caches-delimiter.patch b/backport-lscpu-fix-p-output-all-caches-delimiter.patch deleted file mode 100644 index 9972829..0000000 --- a/backport-lscpu-fix-p-output-all-caches-delimiter.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0da947eb78e3f37f63f33157562c221805ec7fe9 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 17 Apr 2023 10:50:08 +0200 -Subject: [PATCH] lscpu: fix -p --output-all caches delimiter - -Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2187099 -Signed-off-by: Karel Zak ---- - sys-utils/lscpu.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c -index 3f28db61c..8333dcbea 100644 ---- a/sys-utils/lscpu.c -+++ b/sys-utils/lscpu.c -@@ -1444,6 +1444,7 @@ int main(int argc, char *argv[]) - print_cpus_readable(cxt, columns, ncolumns); - break; - case LSCPU_OUTPUT_PARSABLE: -+ cxt->show_compatible = 1; - if (!ncolumns) { - columns[ncolumns++] = COL_CPU_CPU; - columns[ncolumns++] = COL_CPU_CORE; -@@ -1453,7 +1454,6 @@ int main(int argc, char *argv[]) - columns[ncolumns++] = COL_CPU_SOCKET; - columns[ncolumns++] = COL_CPU_NODE; - columns[ncolumns++] = COL_CPU_CACHE; -- cxt->show_compatible = 1; - } - if (outarg && string_add_to_idarray(outarg, columns, - ARRAY_SIZE(columns), --- -2.27.0 - diff --git a/backport-lslocks-fix-maj-min-scanf.patch b/backport-lslocks-fix-maj-min-scanf.patch deleted file mode 100644 index 53d3814..0000000 --- a/backport-lslocks-fix-maj-min-scanf.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 9b725af7028163bd29d39da3b910dffc903107ee Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 28 Mar 2022 11:39:27 +0200 -Subject: [PATCH] lslocks: fix maj:min scanf - -Fixes: https://github.com/util-linux/util-linux/issues/1633 -Signed-off-by: Karel Zak ---- - misc-utils/lslocks.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c -index 941ef7f..6427318 100644 ---- a/misc-utils/lslocks.c -+++ b/misc-utils/lslocks.c -@@ -224,7 +224,8 @@ static ino_t get_dev_inode(char *str, dev_t *dev) - unsigned int maj = 0, min = 0; - ino_t inum = 0; - -- sscanf(str, "%02x:%02x:%ju", &maj, &min, &inum); -+ if (sscanf(str, "%x:%x:%ju", &maj, &min, &inum) != 3) -+ errx(EXIT_FAILURE, _("failed to parse '%s'"), str); - - *dev = (dev_t) makedev(maj, min); - return inum; --- -2.27.0 - diff --git a/backport-lslogins-fix-free-invalid-pointer.patch b/backport-lslogins-fix-free-invalid-pointer.patch deleted file mode 100644 index c91dff3..0000000 --- a/backport-lslogins-fix-free-invalid-pointer.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 890d4d3f236e2d28db35ea9bc9dc3e5e35db975c Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 7 Jun 2022 09:46:54 +0200 -Subject: [PATCH] lslogins: fix free(): invalid pointer - -Signed-off-by: Karel Zak ---- - login-utils/lslogins.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c -index 3646883e0e..3cb30b74e2 100644 ---- a/login-utils/lslogins.c -+++ b/login-utils/lslogins.c -@@ -490,7 +490,7 @@ static int parse_utmpx(const char *path, size_t *nrecords, struct utmpx **record - - /* optimize allocation according to file size, the realloc() below is - * just fallback only */ -- if (stat(path, &st) == 0 && (size_t) st.st_size > sizeof(struct utmpx)) { -+ if (stat(path, &st) == 0 && (size_t) st.st_size >= sizeof(struct utmpx)) { - imax = st.st_size / sizeof(struct utmpx); - ary = xmalloc(imax * sizeof(struct utmpx)); - } -@@ -1013,6 +1013,9 @@ static void free_ctl(struct lslogins_control *ctl) - { - size_t n = 0; - -+ if (!ctl) -+ return; -+ - free(ctl->wtmp); - free(ctl->btmp); - diff --git a/backport-lslogins-improve-prefixes-interpretation.patch b/backport-lslogins-improve-prefixes-interpretation.patch deleted file mode 100644 index d8d3e64..0000000 --- a/backport-lslogins-improve-prefixes-interpretation.patch +++ /dev/null @@ -1,88 +0,0 @@ -From c51cba1e838ae7e36a843ec785543492bb8737cd Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 7 Jun 2022 09:11:56 +0200 -Subject: [PATCH] lslogins: improve prefixes interpretation - -It seems that for example 'passwd --lock' uses two exclamation marks -in password field. It seems better to assume arbitrary number of '!' -and '*' prefixes. - -The patch also makes description of the PWD-EMPTY output field more -explicit. - -Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2093166 -Signed-off-by: Karel Zak ---- - login-utils/lslogins.c | 33 ++++++++++++++++++++++++++------- - 1 file changed, 26 insertions(+), 7 deletions(-) - -diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c -index 4a1c62fe9d..3646883e0e 100644 ---- a/login-utils/lslogins.c -+++ b/login-utils/lslogins.c -@@ -226,7 +226,7 @@ static const struct lslogins_coldesc coldescs[] = - { - [COL_USER] = { "USER", N_("user name"), N_("Username"), 0.1, SCOLS_FL_NOEXTREMES }, - [COL_UID] = { "UID", N_("user ID"), "UID", 1, SCOLS_FL_RIGHT}, -- [COL_PWDEMPTY] = { "PWD-EMPTY", N_("password not required"), N_("Password not required"), 1, SCOLS_FL_RIGHT }, -+ [COL_PWDEMPTY] = { "PWD-EMPTY", N_("password not defined"), N_("Password not required (empty)"), 1, SCOLS_FL_RIGHT }, - [COL_PWDDENY] = { "PWD-DENY", N_("login by password disabled"), N_("Login by password disabled"), 1, SCOLS_FL_RIGHT }, - [COL_PWDLOCK] = { "PWD-LOCK", N_("password defined, but locked"), N_("Password is locked"), 1, SCOLS_FL_RIGHT }, - [COL_PWDMETHOD] = { "PWD-METHOD", N_("password encryption method"), N_("Password encryption method"), 0.1 }, -@@ -823,23 +823,42 @@ static struct lslogins_user *get_user_info(struct lslogins_control *ctl, const c - break; - case COL_PWDEMPTY: - if (shadow) { -- if (!*shadow->sp_pwdp) /* '\0' */ -+ const char *p = shadow->sp_pwdp; -+ -+ while (p && (*p == '!' || *p == '*')) -+ p++; -+ -+ if (!p || !*p) - user->pwd_empty = STATUS_TRUE; - } else - user->pwd_empty = STATUS_UNKNOWN; - break; - case COL_PWDDENY: - if (shadow) { -- if ((*shadow->sp_pwdp == '!' || -- *shadow->sp_pwdp == '*') && -- !valid_pwd(shadow->sp_pwdp + 1)) -+ const char *p = shadow->sp_pwdp; -+ -+ while (p && (*p == '!' || *p == '*')) -+ p++; -+ -+ if (p && *p && p != shadow->sp_pwdp && !valid_pwd(p)) - user->pwd_deny = STATUS_TRUE; - } else - user->pwd_deny = STATUS_UNKNOWN; - break; - case COL_PWDLOCK: - if (shadow) { -- if (*shadow->sp_pwdp == '!' && valid_pwd(shadow->sp_pwdp + 1)) -+ const char *p = shadow->sp_pwdp; -+ int i = 0; -+ -+ /* 'passwd --lock' uses two exclamation marks, -+ * shadow(5) describes the lock as "field which -+ * starts with an exclamation mark". Let's -+ * support more '!' ... -+ */ -+ while (p && *p == '!') -+ p++, i++; -+ -+ if (i != 0 && (!*p || valid_pwd(p))) - user->pwd_lock = STATUS_TRUE; - } else - user->pwd_lock = STATUS_UNKNOWN; -@@ -848,7 +867,7 @@ static struct lslogins_user *get_user_info(struct lslogins_control *ctl, const c - if (shadow) { - const char *p = shadow->sp_pwdp; - -- if (*p == '!' || *p == '*') -+ while (p && (*p == '!' || *p == '*')) - p++; - user->pwd_method = get_pwd_method(p, NULL, NULL); - } else diff --git a/backport-lsns-fix-the-memory-leak.patch b/backport-lsns-fix-the-memory-leak.patch deleted file mode 100644 index 84ef063..0000000 --- a/backport-lsns-fix-the-memory-leak.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 395f3baed6df1eb736c872ecaa3aa2f05c5dc111 Mon Sep 17 00:00:00 2001 -From: lishengyu -Date: Thu, 23 Jun 2022 14:02:49 +0800 -Subject: [PATCH] lsns: fix the memory leak. - -==28129== 96 bytes in 3 blocks are possibly lost in loss record 1 of 4 -==28129== at 0x4837B65: calloc (vg_replace_malloc.c:752) -==28129== by 0x405C83: xcalloc (xalloc.h:60) -==28129== by 0x405C83: netnsid_cache_add (lsns.c:389) -==28129== by 0x405C83: get_netnsid (lsns.c:486) -==28129== by 0x405C83: read_process (lsns.c:549) -==28129== by 0x403FB4: read_processes (lsns.c:586) -==28129== by 0x403FB4: main (lsns.c:1417) -==28129== -==28129== 119,664 (384 direct, 119,280 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4 -==28129== at 0x4837B65: calloc (vg_replace_malloc.c:752) -==28129== by 0x4055F5: xcalloc (xalloc.h:60) -==28129== by 0x4055F5: read_process (lsns.c:516) -==28129== by 0x403FB4: read_processes (lsns.c:586) -==28129== by 0x403FB4: main (lsns.c:1417) ---- - include/list.h | 19 +++++++++++++++++++ - sys-utils/lsns.c | 25 +++++++++++++++++++++++++ - 2 files changed, 44 insertions(+) - -diff --git a/include/list.h b/include/list.h -index 96c84e5..b6bbbdd 100644 ---- a/include/list.h -+++ b/include/list.h -@@ -208,6 +208,25 @@ _INLINE_ void list_splice(struct list_head *list, struct list_head *head) - for (pos = (head)->next, pnext = pos->next; pos != (head); \ - pos = pnext, pnext = pos->next) - -+/** -+ * list_free - remove all entries from list and call freefunc() -+ * for each entry -+ * @head: the head for your list -+ * @type: the type of the struct this is embedded in. -+ * @member: the name of the list_struct within the struct. -+ * @freefunc: the list entry deallocator -+ */ -+#define list_free(head, type, member, freefunc) \ -+ do { \ -+ struct list_head *__p, *__pnext; \ -+ \ -+ list_for_each_safe (__p, __pnext, (head)) { \ -+ type *__elt = list_entry(__p, type, member); \ -+ list_del(__p); \ -+ freefunc(__elt); \ -+ } \ -+ } while (0) -+ - _INLINE_ size_t list_count_entries(struct list_head *head) - { - struct list_head *pos; -diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c -index 8e25ff1..baa80bd 100644 ---- a/sys-utils/lsns.c -+++ b/sys-utils/lsns.c -@@ -953,6 +953,28 @@ static int show_namespace_processes(struct lsns *ls, struct lsns_namespace *ns) - return 0; - } - -+static void free_lsns_process(struct lsns_process *lsns_p) -+{ -+ free(lsns_p); -+} -+ -+static void free_netnsid_caches(struct netnsid_cache *cache) -+{ -+ free(cache); -+} -+ -+static void free_lsns_namespace(struct lsns_namespace *lsns_n) -+{ -+ free(lsns_n); -+} -+ -+static void free_all(struct lsns *ls) -+{ -+ list_free(&ls->processes, struct lsns_process, processes, free_lsns_process); -+ list_free(&netnsids_cache, struct netnsid_cache, netnsids, free_netnsid_caches); -+ list_free(&ls->namespaces, struct lsns_namespace, namespaces, free_lsns_namespace); -+} -+ - static void __attribute__((__noreturn__)) usage(void) - { - FILE *out = stdout; -@@ -1162,5 +1184,8 @@ int main(int argc, char *argv[]) - if (netlink_fd >= 0) - close(netlink_fd); - free_idcache(uid_cache); -+ -+ free_all(&ls); -+ - return r == 0 ? EXIT_SUCCESS : EXIT_FAILURE; - } --- -2.27.0 - diff --git a/backport-mcookie-fix-infinite-loop-when-use-f.patch b/backport-mcookie-fix-infinite-loop-when-use-f.patch deleted file mode 100644 index 9dbb05a..0000000 --- a/backport-mcookie-fix-infinite-loop-when-use-f.patch +++ /dev/null @@ -1,26 +0,0 @@ -From d380bf23fd68ebc2799eabcd86fb43de797b93d8 Mon Sep 17 00:00:00 2001 -From: Hiroaki Sengoku -Date: Fri, 15 Oct 2021 14:02:46 +0900 -Subject: [PATCH] mcookie: fix infinite-loop when use -f - -Signed-off-by: Karel Zak ---- - misc-utils/mcookie.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/misc-utils/mcookie.c b/misc-utils/mcookie.c -index 3157401..be5c34a 100644 ---- a/misc-utils/mcookie.c -+++ b/misc-utils/mcookie.c -@@ -65,7 +65,7 @@ static uint64_t hash_file(struct mcookie_control *ctl, int fd) - rdsz = wanted - count; - - r = read_all(fd, (char *) buf, rdsz); -- if (r < 0) -+ if (r <= 0) - break; - ul_MD5Update(&ctl->ctx, buf, r); - count += r; --- -1.8.3.1 - diff --git a/backport-mkswap-do-not-use-uninitialized-stack-value.patch b/backport-mkswap-do-not-use-uninitialized-stack-value.patch deleted file mode 100644 index 45d7875..0000000 --- a/backport-mkswap-do-not-use-uninitialized-stack-value.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 6c88722c175adca5b1a72bcc770f94674405b7f4 Mon Sep 17 00:00:00 2001 -From: Samanta Navarro -Date: Fri, 13 Jan 2023 11:53:41 +0000 -Subject: [PATCH] mkswap: do not use uninitialized stack value - -If blkdev_get_size fails, then size is not set. Exit with an error code -and indicate what went wrong instead of continuing with random stack -content. - -Proof of Concept: - -``` -$ mkswap /dev/null -mkswap: warning: truncating swap area to 17179869180 KiB -mkswap: /dev/null: insecure permissions 0666, fix with: chmod 0600 /dev/null -mkswap: unable to assign device to libblkid probe -``` - -The first output line depends on stack content and sometimes does not -show up at all. Abort operation if argument is neither regular file nor -block device. - -Signed-off-by: Samanta Navarro ---- - disk-utils/mkswap.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c -index 7e2164704..bd0230177 100644 ---- a/disk-utils/mkswap.c -+++ b/disk-utils/mkswap.c -@@ -345,8 +345,9 @@ static unsigned long long get_size(const struct mkswap_control *ctl) - fd = open(ctl->devname, O_RDONLY); - if (fd < 0) - err(EXIT_FAILURE, _("cannot open %s"), ctl->devname); -- if (blkdev_get_size(fd, &size) == 0) -- size /= ctl->pagesize; -+ if (blkdev_get_size(fd, &size) < 0) -+ err(EXIT_FAILURE, _("cannot determine size of %s"), ctl->devname); -+ size /= ctl->pagesize; - - close(fd); - return size; --- -2.27.0 - diff --git a/backport-partx-remove-memory-leak-to-make-scanners-happy-coverity-scan.patch b/backport-partx-remove-memory-leak-to-make-scanners-happy-coverity-scan.patch deleted file mode 100644 index 81cd0d6..0000000 --- a/backport-partx-remove-memory-leak-to-make-scanners-happy-coverity-scan.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 9ae0289e8142097f4d3cf91bd4d1f2a5621914c7 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 17 Mar 2022 11:22:29 +0100 -Subject: [PATCH] partx: remove memory leak to make scanners happy [coverity - scan] - -Signed-off-by: Karel Zak ---- - disk-utils/partx.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/disk-utils/partx.c b/disk-utils/partx.c -index 07b3e28b9e..76872907fe 100644 ---- a/disk-utils/partx.c -+++ b/disk-utils/partx.c -@@ -1013,6 +1013,7 @@ int main(int argc, char **argv) - errx(EXIT_FAILURE, _("%s: partitioned loop devices unsupported"), - wholedisk); - assoc_loopdev(wholedisk); -+ free(wholedisk); - wholedisk = xstrdup(lc.device); - } else if (!S_ISBLK(x.st_mode)) - errx(EXIT_FAILURE, _("%s: not a block device"), wholedisk); -@@ -1061,6 +1062,8 @@ int main(int argc, char **argv) - blkid_free_probe(pr); - } - -+ free(wholedisk); -+ - if (loopdev) - loopcxt_deinit(&lc); - diff --git a/backport-script-fix-passing-args-to-execlp.patch b/backport-script-fix-passing-args-to-execlp.patch deleted file mode 100644 index ab1dfd6..0000000 --- a/backport-script-fix-passing-args-to-execlp.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 521eb0571eef9352c99d8e401fc8d73d626014cf Mon Sep 17 00:00:00 2001 -From: Jakub Wilk -Date: Tue, 1 Mar 2022 17:15:45 +0100 -Subject: [PATCH] script: fix passing args to execlp() - -Fixes: - - $ SHELL=bash script -q -c 'echo Hello world' - -c: echo Hello world: No such file or directory - -Signed-off-by: Jakub Wilk ---- - term-utils/script.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/term-utils/script.c b/term-utils/script.c -index c8b55c8..89bd0ed 100644 ---- a/term-utils/script.c -+++ b/term-utils/script.c -@@ -975,9 +975,9 @@ int main(int argc, char **argv) - execl(shell, shname, "-i", (char *)NULL); - } else { - if (command) -- execlp(shname, "-c", command, (char *)NULL); -+ execlp(shname, shname, "-c", command, (char *)NULL); - else -- execlp(shname, "-i", (char *)NULL); -+ execlp(shname, shname, "-i", (char *)NULL); - } - - err(EXIT_FAILURE, "failed to execute %s", shell); --- -2.27.0 - diff --git a/backport-script-fix-use-of-utempter.patch b/backport-script-fix-use-of-utempter.patch deleted file mode 100644 index 51f5a40..0000000 --- a/backport-script-fix-use-of-utempter.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 6ed644fbf4869a7e042826900eff531cf6660cfb Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 16 Nov 2022 09:19:18 +0100 -Subject: [PATCH] script: fix use of utempter - -libutempter uses SIGCHLD, but script(1) pty implementation completely -control all signals by signalfd and utempter does not work. - -The solution is to setup signalfd later (after libutempter use). - -Fixes: https://github.com/util-linux/util-linux/issues/1904 -Signed-off-by: Karel Zak ---- - term-utils/script.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/term-utils/script.c b/term-utils/script.c -index c918ecd6e..516a6cf93 100644 ---- a/term-utils/script.c -+++ b/term-utils/script.c -@@ -947,13 +947,16 @@ int main(int argc, char **argv) - printf(_(".\n")); - } - --#ifdef HAVE_LIBUTEMPTER -- utempter_add_record(ul_pty_get_childfd(ctl.pty), NULL); --#endif - - if (ul_pty_setup(ctl.pty)) - err(EXIT_FAILURE, _("failed to create pseudo-terminal")); - -+#ifdef HAVE_LIBUTEMPTER -+ utempter_add_record(ul_pty_get_childfd(ctl.pty), NULL); -+#endif -+ -+ if (ul_pty_signals_setup(ctl.pty)) -+ err(EXIT_FAILURE, _("failed to initialize signals handler")); - fflush(stdout); - - /* --- -2.27.0 - diff --git a/backport-scriptlive-fix-argv-0-for-execlp.patch b/backport-scriptlive-fix-argv-0-for-execlp.patch deleted file mode 100644 index b31ecee..0000000 --- a/backport-scriptlive-fix-argv-0-for-execlp.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 65856a0deb7200b78f858ba7dc66077f3469e924 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 2 Mar 2022 10:00:46 +0100 -Subject: [PATCH] scriptlive: fix argv[0] for execlp() - -Signed-off-by: Karel Zak ---- - term-utils/scriptlive.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/term-utils/scriptlive.c b/term-utils/scriptlive.c -index 37f092c1ff..d81712d36f 100644 ---- a/term-utils/scriptlive.c -+++ b/term-utils/scriptlive.c -@@ -321,9 +321,9 @@ main(int argc, char *argv[]) - execl(shell, shname, "-i", (char *)NULL); - } else { - if (command) -- execlp(shname, "-c", command, (char *)NULL); -+ execlp(shname, shname, "-c", command, (char *)NULL); - else -- execlp(shname, "-i", (char *)NULL); -+ execlp(shname, shname, "-i", (char *)NULL); - } - err(EXIT_FAILURE, "failed to execute %s", shell); - break; diff --git a/backport-sfdisk-fix-typo-in-move-data-when-check-partition-size.patch b/backport-sfdisk-fix-typo-in-move-data-when-check-partition-size.patch deleted file mode 100644 index 840060e..0000000 --- a/backport-sfdisk-fix-typo-in-move-data-when-check-partition-size.patch +++ /dev/null @@ -1,26 +0,0 @@ -From b383155ac6a94f14f5c661d2e4a62c1eef5b6e27 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 8 Nov 2021 14:01:55 +0100 -Subject: [PATCH] sfdisk: fix typo in --move-data when check partition size - -Signed-off-by: Karel Zak ---- - disk-utils/sfdisk.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c -index b08c945..65256c8 100644 ---- a/disk-utils/sfdisk.c -+++ b/disk-utils/sfdisk.c -@@ -418,7 +418,7 @@ static int move_partition_data(struct sfdisk *sf, size_t partno, struct fdisk_pa - warnx(_("failed to get start of the old partition; ignoring --move-data")); - else if (fdisk_partition_get_start(pa) == fdisk_partition_get_start(orig_pa)) - warnx(_("start of the partition has not been moved; ignoring --move-data")); -- else if (fdisk_partition_get_size(orig_pa) < fdisk_partition_get_size(pa)) -+ else if (fdisk_partition_get_size(orig_pa) > fdisk_partition_get_size(pa)) - warnx(_("new partition is smaller than original; ignoring --move-data")); - else - ok = 1; --- -2.27.0 - diff --git a/backport-sfdisk-write-empty-label-also-when-only-ignored-part.patch b/backport-sfdisk-write-empty-label-also-when-only-ignored-part.patch deleted file mode 100644 index 5d00d39..0000000 --- a/backport-sfdisk-write-empty-label-also-when-only-ignored-part.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 9e9ad25d690b284427f9a355475bcdddb17cf1e0 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 19 Aug 2021 12:10:02 +0200 -Subject: [PATCH] sfdisk: write empty label also when only ignored partition - specified - -sfdisk writes empty disk label only when "label:" header specified. -Unfortunately, this feature is ignored when all specified partitions -are ignored - - echo -e "label: dos\n0,0,0\n" | sfdisk /dev/sdc - -Fixes: https://github.com/karelzak/util-linux/issues/1413 -Signed-off-by: Karel Zak ---- - disk-utils/sfdisk.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c -index 526d090..b08c945 100644 ---- a/disk-utils/sfdisk.c -+++ b/disk-utils/sfdisk.c -@@ -1714,7 +1714,7 @@ static void refresh_prompt_buffer(struct sfdisk *sf, const char *devname, - */ - static int command_fdisk(struct sfdisk *sf, int argc, char **argv) - { -- int rc = 0, partno = sf->partno, created = 0, unused = 0; -+ int rc = 0, partno = sf->partno, created = 0, unused = 0, ignored = 0; - struct fdisk_script *dp; - struct fdisk_table *tb = NULL; - const char *devname = NULL, *label; -@@ -1897,6 +1897,7 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv) - if (ignore_partition(pa)) { - fdisk_info(sf->cxt, _("Ignoring partition.")); - next_partno++; -+ ignored++; - continue; - } - if (!created) { /* create a new disklabel */ -@@ -1960,7 +1961,7 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv) - /* create empty disk label if label, but no partition specified */ - if ((rc == SFDISK_DONE_EOF || rc == SFDISK_DONE_WRITE) && created == 0 - && fdisk_script_has_force_label(dp) == 1 -- && fdisk_table_get_nents(tb) == 0 -+ && fdisk_table_get_nents(tb) == (size_t) ignored - && fdisk_script_get_header(dp, "label")) { - - int xrc = fdisk_apply_script_headers(sf->cxt, dp); --- -1.8.3.1 - diff --git a/backport-su-bash-completion-offer-usernames-rather-than-files.patch b/backport-su-bash-completion-offer-usernames-rather-than-files.patch deleted file mode 100644 index 11f723d..0000000 --- a/backport-su-bash-completion-offer-usernames-rather-than-files.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 49609c78e9441dab686da4eda38df1dcca3cacc9 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 31 Aug 2021 12:51:40 +0200 -Subject: [PATCH] su: (bash-completion) offer usernames rather than files - -Fixes: https://github.com/karelzak/util-linux/issues/1424 -Signed-off-by: Karel Zak ---- - bash-completion/su | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/bash-completion/su b/bash-completion/su -index 3095050..913e445 100644 ---- a/bash-completion/su -+++ b/bash-completion/su -@@ -41,7 +41,7 @@ _su_module() - esac - local IFS=$'\n' - compopt -o filenames -- COMPREPLY=( $(compgen -f -- $cur) ) -+ COMPREPLY=( $(compgen -u -- $cur) ) - return 0 - } - complete -F _su_module su --- -1.8.3.1 - diff --git a/backport-sulogin-fix-KDGKBMODE-ifdef.patch b/backport-sulogin-fix-KDGKBMODE-ifdef.patch deleted file mode 100644 index 3dcaf30..0000000 --- a/backport-sulogin-fix-KDGKBMODE-ifdef.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 8efec058d7a513c18f5e5666e79006ded786221a Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 2 May 2023 11:36:49 +0200 -Subject: [PATCH] sulogin: fix KDGKBMODE ifdef - -* remove ifdef-else for KDGKBMODE - -* always call KDGKBMODE for virtual console to get K_UNICODE status - -* use KDGKBMODE as a fallback to detect serial line - -Fixes: https://github.com/util-linux/util-linux/issues/2185 -Suggested-by: Marcos Mello -Signed-off-by: Karel Zak ---- - login-utils/sulogin.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c -index 851d92d..3507272 100644 ---- a/login-utils/sulogin.c -+++ b/login-utils/sulogin.c -@@ -108,7 +108,7 @@ static void tcinit(struct console *con) - struct termios *tio = &con->tio; - const int fd = con->fd; - #if defined(TIOCGSERIAL) -- struct serial_struct serinfo; -+ struct serial_struct serinfo = { .flags = 0 }; - #endif - #ifdef USE_PLYMOUTH_SUPPORT - struct termios lock; -@@ -132,18 +132,18 @@ static void tcinit(struct console *con) - errno = 0; - #endif - --#if defined(TIOCGSERIAL) -+#ifdef TIOCGSERIAL - if (ioctl(fd, TIOCGSERIAL, &serinfo) >= 0) - con->flags |= CON_SERIAL; - errno = 0; --#else --# if defined(KDGKBMODE) -- if (ioctl(fd, KDGKBMODE, &mode) < 0) -+#endif -+ -+#ifdef KDGKBMODE -+ if (!(con->flags & CON_SERIAL) -+ && ioctl(fd, KDGKBMODE, &mode) < 0) - con->flags |= CON_SERIAL; - errno = 0; --# endif - #endif -- - if (tcgetattr(fd, tio) < 0) { - int saveno = errno; - #if defined(KDGKBMODE) || defined(TIOCGSERIAL) --- -2.33.0 - diff --git a/backport-sulogin-ignore-none-existing-console-devices.patch b/backport-sulogin-ignore-none-existing-console-devices.patch deleted file mode 100644 index 59e8079..0000000 --- a/backport-sulogin-ignore-none-existing-console-devices.patch +++ /dev/null @@ -1,227 +0,0 @@ -From 0d092db5c40b94e1ea9529f3f1c384a74eca19f8 Mon Sep 17 00:00:00 2001 -From: Werner Fink -Date: Mon, 17 May 2021 17:20:32 +0200 -Subject: [PATCH] sulogin: ignore none-existing console devices - -and also none-functional console devices. Redirect the error -messages to the appropiate console device. - -Signed-off-by: Werner Fink ---- - login-utils/sulogin-consoles.h | 1 + - login-utils/sulogin.c | 92 ++++++++++++++++++++++++++++------ - 2 files changed, 79 insertions(+), 14 deletions(-) - -diff --git a/login-utils/sulogin-consoles.h b/login-utils/sulogin-consoles.h -index 0bfbc38..12032c9 100644 ---- a/login-utils/sulogin-consoles.h -+++ b/login-utils/sulogin-consoles.h -@@ -40,6 +40,7 @@ struct console { - int fd, id; - #define CON_SERIAL 0x0001 - #define CON_NOTTY 0x0002 -+#define CON_EIO 0x0004 - pid_t pid; - struct chardata cp; - struct termios tio; -diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c -index 4d48943..df27896 100644 ---- a/login-utils/sulogin.c -+++ b/login-utils/sulogin.c -@@ -52,6 +52,7 @@ - #ifdef __linux__ - # include - # include -+# include - #endif - - #include "c.h" -@@ -106,6 +107,9 @@ static void tcinit(struct console *con) - int flags = 0, mode = 0; - struct termios *tio = &con->tio; - const int fd = con->fd; -+#if defined(TIOCGSERIAL) -+ struct serial_struct serinfo; -+#endif - #ifdef USE_PLYMOUTH_SUPPORT - struct termios lock; - int i = (plymouth_command(MAGIC_PING)) ? PLYMOUTH_TERMIOS_FLAGS_DELAY : 0; -@@ -125,27 +129,72 @@ static void tcinit(struct console *con) - } - memset(&lock, 0, sizeof(struct termios)); - ioctl(fd, TIOCSLCKTRMIOS, &lock); -+ errno = 0; - #endif -+ -+#if defined(TIOCGSERIAL) -+ if (ioctl(fd, TIOCGSERIAL, &serinfo) >= 0) -+ con->flags |= CON_SERIAL; -+ errno = 0; -+#else -+# if defined(KDGKBMODE) -+ if (ioctl(fd, KDGKBMODE, &mode) < 0) -+ con->flags |= CON_SERIAL; - errno = 0; -+# endif -+#endif - - if (tcgetattr(fd, tio) < 0) { -- warn(_("tcgetattr failed")); -- con->flags |= CON_NOTTY; -- return; -+ int saveno = errno; -+#if defined(KDGKBMODE) || defined(TIOCGSERIAL) -+ if (con->flags & CON_SERIAL) { /* Try to recover this */ -+ -+# if defined(TIOCGSERIAL) -+ serinfo.flags |= ASYNC_SKIP_TEST; /* Skip test of UART */ -+ -+ if (ioctl(fd, TIOCSSERIAL, &serinfo) < 0) -+ goto tcgeterr; -+ if (ioctl(fd, TIOCSERCONFIG) < 0) /* Try to autoconfigure */ -+ goto tcgeterr; -+ if (ioctl(fd, TIOCGSERIAL, &serinfo) < 0) -+ goto tcgeterr; /* Ouch */ -+# endif -+ if (tcgetattr(fd, tio) < 0) /* Retry to get tty attributes */ -+ saveno = errno; -+ } -+# if defined(TIOCGSERIAL) -+ tcgeterr: -+# endif -+ if (saveno) -+#endif -+ { -+ FILE *fcerr = fdopen(fd, "w"); -+ if (fcerr) { -+ fprintf(fcerr, _("tcgetattr failed")); -+ fclose(fcerr); -+ } -+ warn(_("tcgetattr failed")); -+ -+ con->flags &= ~CON_SERIAL; -+ if (saveno != EIO) -+ con->flags |= CON_NOTTY; -+ else -+ con->flags |= CON_EIO; -+ -+ errno = 0; -+ return; -+ } - } - - /* Handle lines other than virtual consoles here */ --#if defined(KDGKBMODE) -- if (ioctl(fd, KDGKBMODE, &mode) < 0) -+#if defined(KDGKBMODE) || defined(TIOCGSERIAL) -+ if (con->flags & CON_SERIAL) - #endif - { - speed_t ispeed, ospeed; - struct winsize ws; - errno = 0; - -- /* this is a modem line */ -- con->flags |= CON_SERIAL; -- - /* Flush input and output queues on modem lines */ - tcflush(fd, TCIOFLUSH); - -@@ -222,6 +271,8 @@ static void tcfinal(struct console *con) - struct termios *tio = &con->tio; - const int fd = con->fd; - -+ if (con->flags & CON_EIO) -+ return; - if ((con->flags & CON_SERIAL) == 0) { - xsetenv("TERM", "linux", 1); - return; -@@ -559,12 +610,16 @@ err: - static void setup(struct console *con) - { - int fd = con->fd; -- const pid_t pid = getpid(), pgrp = getpgid(0), ppgrp = -- getpgid(getppid()), ttypgrp = tcgetpgrp(fd); -+ const pid_t pid = getpid(), pgrp = getpgid(0), ppgrp = getpgid(getppid()); -+ pid_t ttypgrp; - - if (con->flags & CON_NOTTY) -+ goto notty; -+ if (con->flags & CON_EIO) - return; - -+ ttypgrp = tcgetpgrp(fd); -+ - /* - * Only go through this trouble if the new - * tty doesn't fall in this process group. -@@ -587,6 +642,7 @@ static void setup(struct console *con) - ioctl(fd, TIOCSCTTY, (char *)1); - tcsetpgrp(fd, ppgrp); - } -+notty: - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); -@@ -616,15 +672,19 @@ static char *getpasswd(struct console *con) - int eightbit; - const int fd = con->fd; - -- if (con->flags & CON_NOTTY) -+ if (con->flags & CON_EIO) - goto out; -+ - cp = &con->cp; - tty = con->tio; - -+ tc = 0; - ret = pass; - tty.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY); - tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP|ISIG); -- tc = (tcsetattr(fd, TCSAFLUSH, &tty) == 0); -+ -+ if ((con->flags & CON_NOTTY) == 0) -+ tc = (tcsetattr(fd, TCSAFLUSH, &tty) == 0); - - sigemptyset(&sa.sa_mask); - sa.sa_handler = alrm_handler; -@@ -650,11 +710,12 @@ static char *getpasswd(struct console *con) - } - ret = NULL; - switch (errno) { -- case 0: - case EIO: -+ con->flags |= CON_EIO; - case ESRCH: - case EINVAL: - case ENOENT: -+ case 0: - break; - default: - warn(_("cannot read %s"), con->tty); -@@ -976,10 +1037,13 @@ int main(int argc, char **argv) - con = list_entry(ptr, struct console, entry); - if (con->id >= CONMAX) - break; -+ if (con->flags & CON_EIO) -+ goto next; - - switch ((con->pid = fork())) { - case 0: - mask_signal(SIGCHLD, SIG_DFL, NULL); -+ dup2(con->fd, STDERR_FILENO); - nofork: - setup(con); - while (1) { -@@ -1040,7 +1104,7 @@ int main(int argc, char **argv) - default: - break; - } -- -+ next: - ptr = ptr->next; - - } while (ptr != &consoles); --- -2.33.0 - diff --git a/backport-sysfs-fallback-for-partitions-not-including-parent-name.patch b/backport-sysfs-fallback-for-partitions-not-including-parent-name.patch deleted file mode 100644 index adb123a..0000000 --- a/backport-sysfs-fallback-for-partitions-not-including-parent-name.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 9b59641bcec3df9c451eea4c7057751a153a3fcb Mon Sep 17 00:00:00 2001 -From: Portisch -Date: Mon, 8 Nov 2021 12:31:39 +0100 -Subject: [PATCH] sysfs: fallback for partitions not including parent name - ---- - lib/sysfs.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/lib/sysfs.c b/lib/sysfs.c -index bb71833193..191d870f66 100644 ---- a/lib/sysfs.c -+++ b/lib/sysfs.c -@@ -210,9 +210,10 @@ int sysfs_blkdev_is_partition_dirent(DIR *dir, struct dirent *d, const char *par - d->d_type != DT_UNKNOWN) - return 0; - #endif -+ size_t len = 0; -+ - if (parent_name) { - const char *p = parent_name; -- size_t len; - - /* /dev/sda --> "sda" */ - if (*parent_name == '/') { -@@ -223,14 +224,15 @@ int sysfs_blkdev_is_partition_dirent(DIR *dir, struct dirent *d, const char *par - } - - len = strlen(p); -- if (strlen(d->d_name) <= len) -- return 0; -+ if ((strlen(d->d_name) <= len) || (strncmp(p, d->d_name, len) != 0)) -+ len = 0; -+ } - -+ if (len > 0) { - /* partitions subdir name is - * "[:digit:]" or "p[:digit:]" - */ -- return strncmp(p, d->d_name, len) == 0 && -- ((*(d->d_name + len) == 'p' && isdigit(*(d->d_name + len + 1))) -+ return ((*(d->d_name + len) == 'p' && isdigit(*(d->d_name + len + 1))) - || isdigit(*(d->d_name + len))); - } - diff --git a/backport-unshare-Move-implementation-of-keep-caps-option-to-l.patch b/backport-unshare-Move-implementation-of-keep-caps-option-to-l.patch index 8d659a1..4ce6ad4 100644 --- a/backport-unshare-Move-implementation-of-keep-caps-option-to-l.patch +++ b/backport-unshare-Move-implementation-of-keep-caps-option-to-l.patch @@ -16,7 +16,7 @@ Signed-off-by: David Gibson 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/include/caputils.h b/include/caputils.h -index 852903a..8fc214e 100644 +index 852903a6e..8fc214e7f 100644 --- a/include/caputils.h +++ b/include/caputils.h @@ -31,4 +31,6 @@ extern int capget(cap_user_header_t header, const cap_user_data_t data); @@ -27,13 +27,13 @@ index 852903a..8fc214e 100644 + #endif /* CAPUTILS_H */ diff --git a/lib/caputils.c b/lib/caputils.c -index 13a376b..e01a74e 100644 +index 987533a34..3041c3078 100644 --- a/lib/caputils.c +++ b/lib/caputils.c @@ -24,6 +24,7 @@ #include "caputils.h" - #include "procutils.h" #include "pathnames.h" + #include "procfs.h" +#include "nls.h" static int test_cap(unsigned int cap) @@ -83,10 +83,10 @@ index 13a376b..e01a74e 100644 int main(int argc, char *argv[]) { diff --git a/sys-utils/unshare.c b/sys-utils/unshare.c -index 820691b..e914aa1 100644 +index 2aa239eff..13aefa96c 100644 --- a/sys-utils/unshare.c +++ b/sys-utils/unshare.c -@@ -668,42 +668,8 @@ int main(int argc, char *argv[]) +@@ -1089,42 +1089,8 @@ int main(int argc, char *argv[]) if (force_uid && setuid(uid) < 0) /* change UID */ err(EXIT_FAILURE, _("setuid failed")); diff --git a/backport-vipw-flush-stdout-before-getting-answer.patch b/backport-vipw-flush-stdout-before-getting-answer.patch deleted file mode 100644 index 82b9cca..0000000 --- a/backport-vipw-flush-stdout-before-getting-answer.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 56bacb552d017858751aac208987604f7c9387c7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=89rico=20Nogueira?= -Date: Fri, 22 Oct 2021 14:28:50 -0300 -Subject: [PATCH] vipw: flush stdout before getting answer. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Otherwise the question is displayed only after the user presses Return, -and the program looks like it's hanging. - -This happens at least on musl libc. - -Reported by @loreb. - -Signed-off-by: Érico Nogueira ---- - login-utils/vipw.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/login-utils/vipw.c b/login-utils/vipw.c -index f178c8f..bf76f51 100644 ---- a/login-utils/vipw.c -+++ b/login-utils/vipw.c -@@ -353,6 +353,7 @@ int main(int argc, char *argv[]) - * which means they can be translated. */ - printf(_("Would you like to edit %s now [y/n]? "), orig_file); - -+ fflush(stdout); - if (fgets(response, sizeof(response), stdin) && - rpmatch(response) == RPMATCH_YES) - edit_file(1); --- -1.8.3.1 - diff --git a/backport-wall-convert-homebrew-buffering-to-open_memstream.patch b/backport-wall-convert-homebrew-buffering-to-open_memstream.patch deleted file mode 100644 index 6ed5964..0000000 --- a/backport-wall-convert-homebrew-buffering-to-open_memstream.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 27ee6446503af7ec0c2647704ca47ac4de3852ef Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= -Date: Wed, 15 Mar 2023 16:16:43 +0100 -Subject: [PATCH] wall: convert homebrew buffering to open_memstream() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The struct buffer system duplicates a plethora of standard I/O -functions (including a fork of fputc_careful()) -and adds a lot of complexity ‒ open_memstream() is standard, -and fits perfectly into this niche ---- - term-utils/wall.c | 95 ++++++++++------------------------------------- - 1 file changed, 20 insertions(+), 75 deletions(-) - -diff --git a/term-utils/wall.c b/term-utils/wall.c -index c601d3e5b..a51a92829 100644 ---- a/term-utils/wall.c -+++ b/term-utils/wall.c -@@ -274,74 +274,22 @@ int main(int argc, char **argv) - exit(EXIT_SUCCESS); - } - --struct buffer { -- size_t sz; -- size_t used; -- char *data; --}; -- --static void buf_enlarge(struct buffer *bs, size_t len) -+static void buf_putc_careful(FILE *fs, int c) - { -- if (bs->sz == 0 || len > bs->sz - bs->used) { -- bs->sz += len < 128 ? 128 : len; -- bs->data = xrealloc(bs->data, bs->sz); -- } --} -- --static void buf_puts(struct buffer *bs, const char *s) --{ -- size_t len = strlen(s); -- -- buf_enlarge(bs, len + 1); -- memcpy(bs->data + bs->used, s, len + 1); -- bs->used += len; --} -- --static void __attribute__((__format__ (__printf__, 2, 3))) -- buf_printf(struct buffer *bs, const char *fmt, ...) --{ -- int rc; -- va_list ap; -- size_t limit; -- -- buf_enlarge(bs, 0); /* default size */ -- limit = bs->sz - bs->used; -- -- va_start(ap, fmt); -- rc = vsnprintf(bs->data + bs->used, limit, fmt, ap); -- va_end(ap); -- -- if (rc >= 0 && (size_t) rc >= limit) { /* not enough, enlarge */ -- buf_enlarge(bs, (size_t)rc + 1); -- limit = bs->sz - bs->used; -- va_start(ap, fmt); -- rc = vsnprintf(bs->data + bs->used, limit, fmt, ap); -- va_end(ap); -- } -- -- if (rc > 0) -- bs->used += rc; --} -- --static void buf_putc_careful(struct buffer *bs, int c) --{ -- if (isprint(c) || c == '\a' || c == '\t' || c == '\r' || c == '\n') { -- buf_enlarge(bs, 1); -- bs->data[bs->used++] = c; -- } else if (!c_isascii(c)) -- buf_printf(bs, "\\%3o", (unsigned char)c); -- else { -- char tmp[] = { '^', c ^ 0x40, '\0' }; -- buf_puts(bs, tmp); -- } -+ if (isprint(c) || c == '\a' || c == '\t' || c == '\r' || c == '\n') -+ fputc(c, fs); -+ else if (!c_isascii(c)) -+ fprintf(fs, "\\%3o", (unsigned char)c); -+ else -+ fputs((char[]){ '^', c ^ 0x40, '\0' }, fs); - } - - static char *makemsg(char *fname, char **mvec, int mvecsz, - size_t *mbufsize, int print_banner) - { -- struct buffer _bs = {.used = 0}, *bs = &_bs; - register int ch, cnt; -- char *p, *lbuf; -+ char *p, *lbuf, *retbuf; -+ FILE * fs = open_memstream(&retbuf, mbufsize); - long line_max; - - line_max = sysconf(_SC_LINE_MAX); -@@ -379,15 +327,15 @@ static char *makemsg(char *fname, char **mvec, int mvecsz, - */ - /* snprintf is not always available, but the sprintf's here - will not overflow as long as %d takes at most 100 chars */ -- buf_printf(bs, "\r%*s\r\n", TERM_WIDTH, " "); -+ fprintf(fs, "\r%*s\r\n", TERM_WIDTH, " "); - - snprintf(lbuf, line_max, - _("Broadcast message from %s@%s (%s) (%s):"), - whom, hostname, where, date); -- buf_printf(bs, "%-*.*s\007\007\r\n", TERM_WIDTH, TERM_WIDTH, lbuf); -+ fprintf(fs, "%-*.*s\007\007\r\n", TERM_WIDTH, TERM_WIDTH, lbuf); - free(hostname); - } -- buf_printf(bs, "%*s\r\n", TERM_WIDTH, " "); -+ fprintf(fs, "%*s\r\n", TERM_WIDTH, " "); - - if (mvec) { - /* -@@ -396,11 +344,11 @@ static char *makemsg(char *fname, char **mvec, int mvecsz, - int i; - - for (i = 0; i < mvecsz; i++) { -- buf_puts(bs, mvec[i]); -+ fputs(mvec[i], fs); - if (i < mvecsz - 1) -- buf_puts(bs, " "); -+ fputc(' ', fs); - } -- buf_puts(bs, "\r\n"); -+ fputs("\r\n", fs); - } else { - /* - * read message from -@@ -428,23 +376,20 @@ static char *makemsg(char *fname, char **mvec, int mvecsz, - while (fgets(lbuf, line_max, stdin)) { - for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) { - if (cnt == TERM_WIDTH || ch == '\n') { -- for (; cnt < TERM_WIDTH; ++cnt) -- buf_puts(bs, " "); -- buf_puts(bs, "\r\n"); -+ fprintf(fs, "%*s\r\n", TERM_WIDTH - cnt, ""); - cnt = 0; - } - if (ch == '\t') - cnt += (7 - (cnt % 8)); - if (ch != '\n') -- buf_putc_careful(bs, ch); -+ buf_putc_careful(fs, ch); - } - } - } -- buf_printf(bs, "%*s\r\n", TERM_WIDTH, " "); -+ fprintf(fs, "%*s\r\n", TERM_WIDTH, " "); - - free(lbuf); - -- bs->data[bs->used] = '\0'; /* be paranoid */ -- *mbufsize = bs->used; -- return bs->data; -+ fclose(fs); -+ return retbuf; - } --- -2.27.0 - diff --git a/backport-wall-use-fputs_careful.patch b/backport-wall-use-fputs_careful.patch deleted file mode 100644 index 2c75f3b..0000000 --- a/backport-wall-use-fputs_careful.patch +++ /dev/null @@ -1,218 +0,0 @@ -From aa13246a1bf1be9e4f6eb331f4d4d2dbc875e22f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= -Date: Wed, 15 Mar 2023 16:16:48 +0100 -Subject: [PATCH] wall: use fputs_careful() - -LINE_MAX only applies to teletypes in canonical mode: when stdin is a -file, it could still very much tear; start off at 512 for the sprintf(), -then use getline() like in write. - -The line wrapping has one suboptimal edge-case: - $ wall < all - - Broadcast message from nabijaczleweli@tarta (pts/4) (Tue Mar 14 22:31:25 - 2023): - - ^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_ - !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ - KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~^?\200\201\202\203\204\205\206 - \207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232 - \233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256 - \257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302 - \303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326 - \327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352 - \353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376 - \377 -but that's a pathological input, and the result is still infinitely -better than it was before, so fixing that is more trouble than it's -worth. - -Bug-Debian: https://bugs.debian.org/826596 ---- - include/carefulputc.h | 42 +++++++++++++++++++++++++++++++++--------- - login-utils/last.c | 2 +- - term-utils/wall.c | 38 ++++++-------------------------------- - term-utils/write.c | 2 +- - 4 files changed, 41 insertions(+), 43 deletions(-) - -diff --git a/include/carefulputc.h b/include/carefulputc.h -index 740add68e..3cc6f7ff9 100644 ---- a/include/carefulputc.h -+++ b/include/carefulputc.h -@@ -6,6 +6,7 @@ - #include - #ifdef HAVE_WIDECHAR - #include -+#include - #endif - #include - -@@ -15,18 +16,35 @@ - * A puts() for use in write and wall (that sometimes are sgid tty). - * It avoids control and invalid characters. - * The locale of the recipient is nominally unknown, -- * but it's a solid bet that the encoding is compatible with the author's. -+ * but it's a solid bet that it's compatible with the author's. -+ * Use soft_width=0 to disable wrapping. - */ --static inline int fputs_careful(const char * s, FILE *fp, const char ctrl, bool cr_lf) -+static inline int fputs_careful(const char * s, FILE *fp, const char ctrl, bool cr_lf, int soft_width) - { -- int ret = 0; -+ int ret = 0, col = 0; - - for (size_t slen = strlen(s); *s; ++s, --slen) { -- if (*s == '\n') -+ if (*s == '\t') -+ col += (7 - (col % 8)) - 1; -+ else if (*s == '\r') -+ col = -1; -+ else if (*s == '\a') -+ --col; -+ -+ if ((soft_width && col >= soft_width) || *s == '\n') { -+ if (soft_width) { -+ fprintf(fp, "%*s", soft_width - col, ""); -+ col = 0; -+ } - ret = fputs(cr_lf ? "\r\n" : "\n", fp); -- else if (isprint(*s) || *s == '\a' || *s == '\t' || *s == '\r') -+ if (*s == '\n' || ret < 0) -+ goto wrote; -+ } -+ -+ if (isprint(*s) || *s == '\a' || *s == '\t' || *s == '\r') { - ret = putc(*s, fp); -- else if (!c_isascii(*s)) { -+ ++col; -+ } else if (!c_isascii(*s)) { - #ifdef HAVE_WIDECHAR - wchar_t w; - size_t clen = mbtowc(&w, s, slen); -@@ -35,21 +53,27 @@ static inline int fputs_careful(const char * s, FILE *fp, const char ctrl, bool - case (size_t)-1: // EILSEQ - mbtowc(NULL, NULL, 0); - nonprint: -- ret = fprintf(fp, "\\%3hho", *s); -+ col += ret = fprintf(fp, "\\%3hho", *s); - break; - default: - if(!iswprint(w)) - goto nonprint; - ret = fwrite(s, 1, clen, fp); -+ if (soft_width) -+ col += wcwidth(w); - s += clen - 1; - slen -= clen - 1; - break; - } - #else -- ret = fprintf(fp, "\\%3hho", *s); -+ col += ret = fprintf(fp, "\\%3hho", *s); - #endif -- } else -+ } else { - ret = fputs((char[]){ ctrl, *s ^ 0x40, '\0' }, fp); -+ col += 2; -+ } -+ -+ wrote: - if (ret < 0) - return EOF; - } -diff --git a/login-utils/last.c b/login-utils/last.c -index 1b45dbf24..37c6abe97 100644 ---- a/login-utils/last.c -+++ b/login-utils/last.c -@@ -547,7 +547,7 @@ static int list(const struct last_control *ctl, struct utmpx *p, time_t logout_t - /* - * Print out "final" string safely. - */ -- fputs_careful(final, stdout, '*', false); -+ fputs_careful(final, stdout, '*', false, 0); - - if (len < 0 || (size_t)len >= sizeof(final)) - putchar('\n'); -diff --git a/term-utils/wall.c b/term-utils/wall.c -index a51a92829..377db4518 100644 ---- a/term-utils/wall.c -+++ b/term-utils/wall.c -@@ -274,29 +274,13 @@ int main(int argc, char **argv) - exit(EXIT_SUCCESS); - } - --static void buf_putc_careful(FILE *fs, int c) --{ -- if (isprint(c) || c == '\a' || c == '\t' || c == '\r' || c == '\n') -- fputc(c, fs); -- else if (!c_isascii(c)) -- fprintf(fs, "\\%3o", (unsigned char)c); -- else -- fputs((char[]){ '^', c ^ 0x40, '\0' }, fs); --} -- - static char *makemsg(char *fname, char **mvec, int mvecsz, - size_t *mbufsize, int print_banner) - { -- register int ch, cnt; -- char *p, *lbuf, *retbuf; -+ char *lbuf, *retbuf; - FILE * fs = open_memstream(&retbuf, mbufsize); -- long line_max; -- -- line_max = sysconf(_SC_LINE_MAX); -- if (line_max <= 0) -- line_max = 512; -- -- lbuf = xmalloc(line_max); -+ size_t lbuflen = 512; -+ lbuf = xmalloc(lbuflen); - - if (print_banner == TRUE) { - char *hostname = xgethostname(); -@@ -329,7 +313,7 @@ static char *makemsg(char *fname, char **mvec, int mvecsz, - will not overflow as long as %d takes at most 100 chars */ - fprintf(fs, "\r%*s\r\n", TERM_WIDTH, " "); - -- snprintf(lbuf, line_max, -+ snprintf(lbuf, lbuflen, - _("Broadcast message from %s@%s (%s) (%s):"), - whom, hostname, where, date); - fprintf(fs, "%-*.*s\007\007\r\n", TERM_WIDTH, TERM_WIDTH, lbuf); -@@ -373,18 +357,8 @@ static char *makemsg(char *fname, char **mvec, int mvecsz, - /* - * Read message from stdin. - */ -- while (fgets(lbuf, line_max, stdin)) { -- for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) { -- if (cnt == TERM_WIDTH || ch == '\n') { -- fprintf(fs, "%*s\r\n", TERM_WIDTH - cnt, ""); -- cnt = 0; -- } -- if (ch == '\t') -- cnt += (7 - (cnt % 8)); -- if (ch != '\n') -- buf_putc_careful(fs, ch); -- } -- } -+ while (getline(&lbuf, &lbuflen, stdin) >= 0) -+ fputs_careful(lbuf, fs, '^', true, TERM_WIDTH); - } - fprintf(fs, "%*s\r\n", TERM_WIDTH, " "); - -diff --git a/term-utils/write.c b/term-utils/write.c -index b485e28fd..a5a21280c 100644 ---- a/term-utils/write.c -+++ b/term-utils/write.c -@@ -276,7 +276,7 @@ static void do_write(const struct write_control *ctl) - if (signal_received) - break; - -- if (fputs_careful(line, stdout, '^', true) == EOF) -+ if (fputs_careful(line, stdout, '^', true, 0) == EOF) - err(EXIT_FAILURE, _("carefulputc failed")); - } - free(line); --- -2.27.0 - diff --git a/backport-wdctl-mark-flags-field-as-unsigned-long.patch b/backport-wdctl-mark-flags-field-as-unsigned-long.patch deleted file mode 100644 index 3ed728d..0000000 --- a/backport-wdctl-mark-flags-field-as-unsigned-long.patch +++ /dev/null @@ -1,43 +0,0 @@ -From f36f3251c564991070c6b2c2347a999a56564e63 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= -Date: Sun, 8 Jan 2023 03:29:51 +0000 -Subject: [PATCH] wdctl: mark flags field as unsigned long - -This is required by string_to_bitmask(). -The previous cast failed on s390x with the following warning: - -In function 'string_to_bitmask', - inlined from 'string_to_bitmask' at lib/strutils.c:802:5, - inlined from 'main' at sys-utils/wdctl.c:770:8: -lib/strutils.c:829:23: error: write of 64-bit data outside the bound of destination object, data truncated into 32-bit [-Werror=extra] - 829 | *mask |= flag; - | ---- - sys-utils/wdctl.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c -index 8de5d5a..f0d2e8d 100644 ---- a/sys-utils/wdctl.c -+++ b/sys-utils/wdctl.c -@@ -592,7 +592,7 @@ int main(int argc, char *argv[]) - struct wd_device wd; - struct wd_control ctl = { .hide_headings = 0 }; - int c, res = EXIT_SUCCESS, count = 0; -- uint32_t wanted = 0; -+ unsigned long wanted = 0; - int timeout = 0; - const char *dflt_device = NULL; - -@@ -640,7 +640,7 @@ int main(int argc, char *argv[]) - timeout = strtos32_or_err(optarg, _("invalid timeout argument")); - break; - case 'f': -- if (string_to_bitmask(optarg, (unsigned long *) &wanted, name2bit) != 0) -+ if (string_to_bitmask(optarg, &wanted, name2bit) != 0) - return EXIT_FAILURE; - break; - case 'F': --- -2.33.0 - diff --git a/backport-wrap-return-in-else-directive-to-avoid-dead-code.patch b/backport-wrap-return-in-else-directive-to-avoid-dead-code.patch deleted file mode 100644 index d89eecb..0000000 --- a/backport-wrap-return-in-else-directive-to-avoid-dead-code.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 3fe8061d4a7cf2e282ef4b67202d351ce05de4d1 Mon Sep 17 00:00:00 2001 -From: Stefan Radu -Date: Tue, 25 Apr 2023 18:55:07 +0300 -Subject: [PATCH] wrap return in #else directive to avoid dead code - -Signed-off-by: Stefan Radu ---- - login-utils/su-common.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/login-utils/su-common.c b/login-utils/su-common.c -index 67c4fa271..b67492048 100644 ---- a/login-utils/su-common.c -+++ b/login-utils/su-common.c -@@ -343,8 +343,9 @@ static int supam_conv( int num_msg, - return misc_conv(num_msg, msg, resp, data); - #elif defined(HAVE_SECURITY_OPENPAM_H) - return openpam_ttyconv(num_msg, msg, resp, data); --#endif -+#else - return PAM_CONV_ERR; -+#endif - } - - static void supam_cleanup(struct su_context *su, int retcode) --- -2.27.0 - diff --git a/backport-write-correctly-handle-wide-characters.patch b/backport-write-correctly-handle-wide-characters.patch deleted file mode 100644 index 33fae6f..0000000 --- a/backport-write-correctly-handle-wide-characters.patch +++ /dev/null @@ -1,199 +0,0 @@ -From 8a7b8456d1dc0e7ca557d1ac31f638986704757f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= -Date: Wed, 15 Mar 2023 16:16:31 +0100 -Subject: [PATCH] write: correctly handle wide characters -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Do this by replacing fputc_careful() (notice that the description said -it's locale-aware ‒ it very much is /not/), with a fputs_careful() which -does the same thing, but if it were to output a byte in the \123 format, -first it checks whether this byte starts a valid multibyte character. - -If it does, and that character is printable, write it verbatim. -This means that - echo 'foo åäö ąęćźżń bar' | write nabijaczleweli pts/4 -instead of - foo \303\245\303\244\303\266 - \304\205\304\231\304\207\305\272\305\274\305\204 bar -yields - foo åäö ąęćźżń bar -or, more realistically, from a message I got earlier today, - Filip powiedzia\305\202 \305\274e zap\305\202aci jutro -becomes - Filip powiedział że zapłaci jutro - -Invalid/non-printable sequences get processed as before. - -Line reading in write must become getline() to avoid dealing with -partial characters: for example on input consisting solely of -ąęćźżń, where every {1} is an instance, the output would be - {42}ąęć\305\272żń{84}ąęćź\305\274ń{84}ąęćźż\305\204{39} -with just fixed-512 fgets() - -Bug-Debian: https://bugs.debian.org/826596 ---- - include/carefulputc.h | 60 +++++++++++++++++++++++++++++++------------ - login-utils/last.c | 4 +-- - term-utils/write.c | 25 +++++------------- - 3 files changed, 52 insertions(+), 37 deletions(-) - -diff --git a/include/carefulputc.h b/include/carefulputc.h -index 8860b1234..740add68e 100644 ---- a/include/carefulputc.h -+++ b/include/carefulputc.h -@@ -1,31 +1,59 @@ - #ifndef UTIL_LINUX_CAREFULPUTC_H - #define UTIL_LINUX_CAREFULPUTC_H - --/* -- * A putc() for use in write and wall (that sometimes are sgid tty). -- * It avoids control characters in our locale, and also ASCII control -- * characters. Note that the locale of the recipient is unknown. --*/ - #include - #include - #include -+#ifdef HAVE_WIDECHAR -+#include -+#endif -+#include - - #include "cctype.h" - --static inline int fputc_careful(int c, FILE *fp, const char fail) -+/* -+ * A puts() for use in write and wall (that sometimes are sgid tty). -+ * It avoids control and invalid characters. -+ * The locale of the recipient is nominally unknown, -+ * but it's a solid bet that the encoding is compatible with the author's. -+ */ -+static inline int fputs_careful(const char * s, FILE *fp, const char ctrl, bool cr_lf) - { -- int ret; -+ int ret = 0; - -- if (isprint(c) || c == '\a' || c == '\t' || c == '\r' || c == '\n') -- ret = putc(c, fp); -- else if (!c_isascii(c)) -- ret = fprintf(fp, "\\%3o", (unsigned char)c); -- else { -- ret = putc(fail, fp); -- if (ret != EOF) -- ret = putc(c ^ 0x40, fp); -+ for (size_t slen = strlen(s); *s; ++s, --slen) { -+ if (*s == '\n') -+ ret = fputs(cr_lf ? "\r\n" : "\n", fp); -+ else if (isprint(*s) || *s == '\a' || *s == '\t' || *s == '\r') -+ ret = putc(*s, fp); -+ else if (!c_isascii(*s)) { -+#ifdef HAVE_WIDECHAR -+ wchar_t w; -+ size_t clen = mbtowc(&w, s, slen); -+ switch(clen) { -+ case (size_t)-2: // incomplete -+ case (size_t)-1: // EILSEQ -+ mbtowc(NULL, NULL, 0); -+ nonprint: -+ ret = fprintf(fp, "\\%3hho", *s); -+ break; -+ default: -+ if(!iswprint(w)) -+ goto nonprint; -+ ret = fwrite(s, 1, clen, fp); -+ s += clen - 1; -+ slen -= clen - 1; -+ break; -+ } -+#else -+ ret = fprintf(fp, "\\%3hho", *s); -+#endif -+ } else -+ ret = fputs((char[]){ ctrl, *s ^ 0x40, '\0' }, fp); -+ if (ret < 0) -+ return EOF; - } -- return (ret < 0) ? EOF : 0; -+ return 0; - } - - static inline void fputs_quoted_case(const char *data, FILE *out, int dir) -diff --git a/login-utils/last.c b/login-utils/last.c -index d3eeed4b6..1b45dbf24 100644 ---- a/login-utils/last.c -+++ b/login-utils/last.c -@@ -392,7 +392,6 @@ static int list(const struct last_control *ctl, struct utmpx *p, time_t logout_t - char final[512]; - char utline[sizeof(p->ut_line) + 1]; - char domain[256]; -- char *s; - int mins, hours, days; - int r, len; - struct last_timefmt *fmt; -@@ -548,8 +547,7 @@ static int list(const struct last_control *ctl, struct utmpx *p, time_t logout_t - /* - * Print out "final" string safely. - */ -- for (s = final; *s; s++) -- fputc_careful(*s, stdout, '*'); -+ fputs_careful(final, stdout, '*', false); - - if (len < 0 || (size_t)len >= sizeof(final)) - putchar('\n'); -diff --git a/term-utils/write.c b/term-utils/write.c -index 8b86e9a9d..b485e28fd 100644 ---- a/term-utils/write.c -+++ b/term-utils/write.c -@@ -223,21 +223,6 @@ static void signal_handler(int signo) - signal_received = signo; - } - --/* -- * write_line - like fputs(), but makes control characters visible and -- * turns \n into \r\n. -- */ --static void write_line(char *s) --{ -- while (*s) { -- const int c = *s++; -- -- if ((c == '\n' && fputc_careful('\r', stdout, '^') == EOF) -- || fputc_careful(c, stdout, '^') == EOF) -- err(EXIT_FAILURE, _("carefulputc failed")); -- } --} -- - /* - * do_write - actually make the connection - */ -@@ -247,7 +232,8 @@ static void do_write(const struct write_control *ctl) - struct passwd *pwd; - time_t now; - struct tm *tm; -- char *host, line[512]; -+ char *host, *line = NULL; -+ size_t linelen = 0; - struct sigaction sigact; - - /* Determine our login name(s) before the we reopen() stdout */ -@@ -286,11 +272,14 @@ static void do_write(const struct write_control *ctl) - free(host); - printf("\r\n"); - -- while (fgets(line, sizeof(line), stdin) != NULL) { -+ while (getline(&line, &linelen, stdin) >= 0) { - if (signal_received) - break; -- write_line(line); -+ -+ if (fputs_careful(line, stdout, '^', true) == EOF) -+ err(EXIT_FAILURE, _("carefulputc failed")); - } -+ free(line); - printf("EOF\r\n"); - } - --- -2.27.0 - diff --git a/fix-size-use-for-stdin.patch b/fix-size-use-for-stdin.patch deleted file mode 100644 index ee4bdd4..0000000 --- a/fix-size-use-for-stdin.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 58e4ee082bca100034791a4a74481f263bb30a25 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 21 Oct 2021 18:47:40 +0200 -Subject: [PATCH] logger: fix --size use for stdin -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The stdin version counts log header into the message size, but -for example when it reads message from argv[] it counts only message -itself. - - $ logger --stderr --size 3 "abcd" - <13>Oct 21 18:48:29 kzak: abc - - $ echo "abcd" | logger --stderr --size 3 - logger: cannot allocate 18446744073709551597 bytes: Cannot allocate memory - -Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2011602 -Signed-off-by: Karel Zak ---- - misc-utils/logger.c | 13 ++----------- - 1 file changed, 2 insertions(+), 11 deletions(-) - -diff --git a/misc-utils/logger.c b/misc-utils/logger.c -index 25ff2b9308..50ae211056 100644 ---- a/misc-utils/logger.c -+++ b/misc-utils/logger.c -@@ -976,9 +976,7 @@ static void logger_stdin(struct logger_ctl *ctl) - */ - int default_priority = ctl->pri; - int last_pri = default_priority; -- size_t max_usrmsg_size = ctl->max_message_size - strlen(ctl->hdr); -- size_t allocated_usrmsg_size = max_usrmsg_size; -- char *buf = xmalloc(allocated_usrmsg_size + 2 + 2); -+ char *buf = xmalloc(ctl->max_message_size + 2 + 2); - int pri; - int c; - size_t i; -@@ -1006,20 +1004,13 @@ static void logger_stdin(struct logger_ctl *ctl) - - if (ctl->pri != last_pri) { - generate_syslog_header(ctl); -- max_usrmsg_size = ctl->max_message_size - strlen(ctl->hdr); -- -- if (max_usrmsg_size > allocated_usrmsg_size) { -- allocated_usrmsg_size = max_usrmsg_size; -- buf = xrealloc(buf, allocated_usrmsg_size + 2 + 2); -- } -- - last_pri = ctl->pri; - } - if (c != EOF && c != '\n') - c = getchar(); - } - -- while (c != EOF && c != '\n' && i < max_usrmsg_size) { -+ while (c != EOF && c != '\n' && i < ctl->max_message_size) { - buf[i++] = c; - c = getchar(); - } diff --git a/realloc-buffer-when-header-size-changed.patch b/realloc-buffer-when-header-size-changed.patch deleted file mode 100644 index a542097..0000000 --- a/realloc-buffer-when-header-size-changed.patch +++ /dev/null @@ -1,64 +0,0 @@ -From b0a8b8cd9c34600dda7d0503aac2dc0af3012fdc Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 21 Oct 2021 16:00:01 +0200 -Subject: [PATCH] logger: realloc buffer when header size changed - -This is probably paranoid optimization, but when we generate a new -header we need to be sure that buffer is not smaller than calculated -maximal size of user's data. - -Signed-off-by: Karel Zak ---- - misc-utils/logger.c | 21 +++++++++++---------- - 1 file changed, 11 insertions(+), 10 deletions(-) - -diff --git a/misc-utils/logger.c b/misc-utils/logger.c -index 23da164cd6..4511ab1141 100644 ---- a/misc-utils/logger.c -+++ b/misc-utils/logger.c -@@ -979,11 +979,11 @@ static void logger_stdin(struct logger_ctl *ctl) - * update header timestamps and to reflect possible priority changes. - * The initial header is generated by logger_open(). - */ -- int has_header = 1; - int default_priority = ctl->pri; - int last_pri = default_priority; - size_t max_usrmsg_size = ctl->max_message_size - strlen(ctl->hdr); -- char *const buf = xmalloc(max_usrmsg_size + 2 + 2); -+ size_t allocated_usrmsg_size = max_usrmsg_size; -+ char *buf = xmalloc(allocated_usrmsg_size + 2 + 2); - int pri; - int c; - size_t i; -@@ -1010,9 +1010,14 @@ static void logger_stdin(struct logger_ctl *ctl) - ctl->pri = default_priority; - - if (ctl->pri != last_pri) { -- has_header = 0; -- max_usrmsg_size = -- ctl->max_message_size - strlen(ctl->hdr); -+ generate_syslog_header(ctl); -+ max_usrmsg_size = ctl->max_message_size - strlen(ctl->hdr); -+ -+ if (max_usrmsg_size > allocated_usrmsg_size) { -+ allocated_usrmsg_size = max_usrmsg_size; -+ buf = xrealloc(buf, allocated_usrmsg_size + 2 + 2); -+ } -+ - last_pri = ctl->pri; - } - if (c != EOF && c != '\n') -@@ -1025,12 +1030,8 @@ static void logger_stdin(struct logger_ctl *ctl) - } - buf[i] = '\0'; - -- if (i > 0 || !ctl->skip_empty_lines) { -- if (!has_header) -- generate_syslog_header(ctl); -+ if (i > 0 || !ctl->skip_empty_lines) - write_output(ctl, buf); -- has_header = 0; -- } - - if (c == '\n') /* discard line terminator */ - c = getchar(); diff --git a/segmentation-fault-on-invalid-unicode-input-passed-to-s-option.patch b/segmentation-fault-on-invalid-unicode-input-passed-to-s-option.patch deleted file mode 100644 index f08047c..0000000 --- a/segmentation-fault-on-invalid-unicode-input-passed-to-s-option.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 9714331843ef3a6d9c10ff1d3bc5fcf53d44d930 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 31 Aug 2021 12:31:15 +0200 -Subject: [PATCH] column: segmentation fault on invalid unicode input passed to - -s option - -The function mbs_to_wcs() returns NULL on invalid UTF. - -Fixes: https://github.com/karelzak/util-linux/issues/1425 -Signed-off-by: Karel Zak ---- - text-utils/column.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/text-utils/column.c b/text-utils/column.c -index 1bc90e84e3..f9878e4422 100644 ---- a/text-utils/column.c -+++ b/text-utils/column.c -@@ -814,6 +814,8 @@ int main(int argc, char **argv) - case 's': - free(ctl.input_separator); - ctl.input_separator = mbs_to_wcs(optarg); -+ if (!ctl.input_separator) -+ err(EXIT_FAILURE, _("failed to use input separator")); - ctl.greedy = 0; - break; - case 'T': diff --git a/util-linux-2.37.2.tar.xz b/util-linux-2.37.2.tar.xz deleted file mode 100644 index 21f3d62..0000000 Binary files a/util-linux-2.37.2.tar.xz and /dev/null differ diff --git a/util-linux-2.39.1.tar.xz b/util-linux-2.39.1.tar.xz new file mode 100644 index 0000000..28bcec4 Binary files /dev/null and b/util-linux-2.39.1.tar.xz differ diff --git a/util-linux-Add-sw64-architecture.patch b/util-linux-Add-sw64-architecture.patch index 6c71466..33a6c77 100644 --- a/util-linux-Add-sw64-architecture.patch +++ b/util-linux-Add-sw64-architecture.patch @@ -19,10 +19,10 @@ Signed-off-by: wzx 11 files changed, 34 insertions(+), 22 deletions(-) diff --git a/configure b/configure -index 57b830a..48d3a36 100755 +index 0671c06..6bd1f57 100755 --- a/configure +++ b/configure -@@ -36071,6 +36071,7 @@ else +@@ -39881,6 +39881,7 @@ else $as_nop case $host_cpu in #( alpha) syscall="442" ;; #( @@ -30,7 +30,7 @@ index 57b830a..48d3a36 100755 i*86) syscall="289" ;; #( ia64*) syscall="1274" ;; #( powerpc*) syscall="273" ;; #( -@@ -36175,6 +36176,7 @@ else +@@ -39986,6 +39987,7 @@ else $as_nop case $host_cpu in #( alpha) syscall="443" ;; #( @@ -39,10 +39,10 @@ index 57b830a..48d3a36 100755 ia64*) syscall="1275" ;; #( powerpc*) syscall="274" ;; #( diff --git a/configure.ac b/configure.ac -index b12b48c..bf405da 100644 +index 2cb236f..d9d8691 100644 --- a/configure.ac +++ b/configure.ac -@@ -2218,6 +2218,7 @@ UL_BUILD_INIT([ionice]) +@@ -2392,6 +2392,7 @@ UL_BUILD_INIT([ionice]) UL_REQUIRES_SYSCALL_CHECK([ionice], [UL_CHECK_SYSCALL([ioprio_set], [alpha], [442], @@ -50,7 +50,7 @@ index b12b48c..bf405da 100644 [i*86], [289], [ia64*], [1274], [powerpc*], [273], -@@ -2230,6 +2231,7 @@ UL_REQUIRES_SYSCALL_CHECK([ionice], +@@ -2404,6 +2405,7 @@ UL_REQUIRES_SYSCALL_CHECK([ionice], UL_REQUIRES_SYSCALL_CHECK([ionice], [UL_CHECK_SYSCALL([ioprio_get], [alpha], [443], @@ -59,10 +59,10 @@ index b12b48c..bf405da 100644 [ia64*], [1275], [powerpc*], [274], diff --git a/include/pt-bsd.h b/include/pt-bsd.h -index 9bf47a5..c524c44 100644 +index 20c24b7..b878258 100644 --- a/include/pt-bsd.h +++ b/include/pt-bsd.h -@@ -10,7 +10,7 @@ +@@ -14,7 +14,7 @@ #define BSD_LINUX_BOOTDIR "/usr/ucb/mdec" @@ -71,7 +71,7 @@ index 9bf47a5..c524c44 100644 defined (__ia64__) || defined (__hppa__) # define BSD_LABELSECTOR 0 # define BSD_LABELOFFSET 64 -@@ -137,7 +137,7 @@ struct bsd_disklabel { +@@ -141,7 +141,7 @@ struct bsd_disklabel { #define BSD_FS_ADVFS 16 /* Digital Unix AdvFS */ /* this is annoying, but it's also the way it is :-( */ @@ -81,10 +81,10 @@ index 9bf47a5..c524c44 100644 #else #define BSD_FS_MSDOS 8 /* MS-DOS file system */ diff --git a/libblkid/src/partitions/bsd.c b/libblkid/src/partitions/bsd.c -index c745173..ad2bfda 100644 +index ba12019..e7e4486 100644 --- a/libblkid/src/partitions/bsd.c +++ b/libblkid/src/partitions/bsd.c -@@ -166,6 +166,7 @@ nothing: +@@ -183,6 +183,7 @@ nothing: * ------------------------+-------------+------------ * alpha luna88k mac68k | 0 | 64 * sparc(OpenBSD) vax | | @@ -169,10 +169,10 @@ index 313ae5a..875fa11 100644 return BSD_FS_MSDOS; #endif diff --git a/sys-utils/hwclock-rtc.c b/sys-utils/hwclock-rtc.c -index 07af9c8..885ca1e 100644 +index 7094cd0..11adb81 100644 --- a/sys-utils/hwclock-rtc.c +++ b/sys-utils/hwclock-rtc.c -@@ -390,7 +390,7 @@ struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl) +@@ -340,7 +340,7 @@ const struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl) return &rtc_interface; } @@ -182,10 +182,10 @@ index 07af9c8..885ca1e 100644 * Get the Hardware Clock epoch setting from the kernel. */ diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c -index 3609814..37ec0d0 100644 +index 2a18443..87228b5 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c -@@ -1129,7 +1129,7 @@ manipulate_clock(const struct hwclock_control *ctl, const time_t set_time, +@@ -1133,7 +1133,7 @@ manipulate_clock(const struct hwclock_control *ctl, const time_t set_time, * Get or set the kernel RTC driver's epoch on Alpha machines. * ISA machines are hard coded for 1900. */ @@ -194,25 +194,25 @@ index 3609814..37ec0d0 100644 static void manipulate_epoch(const struct hwclock_control *ctl) { -@@ -1172,7 +1172,7 @@ usage(void) - puts(_(" -w, --systohc set the RTC from the system time")); - puts(_(" --systz send timescale configurations to the kernel")); - puts(_(" -a, --adjust adjust the RTC to account for systematic drift")); +@@ -1208,7 +1208,7 @@ usage(void) + puts(_(" -w, --systohc set the RTC from the system time")); + puts(_(" --systz send timescale configurations to the kernel")); + puts(_(" -a, --adjust adjust the RTC to account for systematic drift")); -#if defined(__linux__) && defined(__alpha__) +#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__)) - puts(_(" --getepoch display the RTC epoch")); - puts(_(" --setepoch set the RTC epoch according to --epoch")); + puts(_(" --getepoch display the RTC epoch")); + puts(_(" --setepoch set the RTC epoch according to --epoch")); #endif -@@ -1188,7 +1188,7 @@ usage(void) - " --directisa use the ISA bus instead of %1$s access\n"), _PATH_RTC_DEV); - puts(_(" --date