Projects
openEuler:Mainline
util-linux
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
_service:tar_scm:util-linux.spec
Changed
@@ -3,7 +3,7 @@ Name: util-linux Version: 2.37.2 -Release: 5 +Release: 17 Summary: A random collection of Linux utilities License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git @@ -18,19 +18,67 @@ Source8: util-linux-runuser.pamd Source9: util-linux-runuser-l.pamd -Patch0: 2.36-login-lastlog-create.patch -Patch1: Add-check-to-resolve-uname26-version-test-failed.patch -Patch2: SKIPPED-no-root-permissions-test.patch -Patch3: backport-su-bash-completion-offer-usernames-rather-than-files.patch -Patch4: backport-Fix-memory-leaks-in-the-chcpu.patch -Patch5: backport-logger-fix-prio-prefix-doesn-t-use-priority-default.patch -Patch6: backport-vipw-flush-stdout-before-getting-answer.patch -Patch7: backport-login-Restore-tty-size-after-calling-vhangup.patch -Patch8: backport-Forward-value-of-sector_size-instead-of-its-address.patch -Patch9: backport-libfdisk-dereference-of-possibly-NULL-gcc-analyzer.patch -Patch10: backport-libfdisk-check-calloc-return-gcc-analyzer.patch -Patch11: backport-mcookie-fix-infinite-loop-when-use-f.patch -Patch12: backport-sfdisk-write-empty-label-also-when-only-ignored-part.patch +Patch6000: 2.36-login-lastlog-create.patch +Patch6001: backport-CVE-2021-3995.patch +Patch6002: backport-CVE-2021-3996.patch +Patch6003: realloc-buffer-when-header-size-changed.patch +Patch6004: fix-size-use-for-stdin.patch +Patch6005: segmentation-fault-on-invalid-unicode-input-passed-to-s-option.patch +Patch6006: backport-fix-by-ignoring-EINVAL-on-remount-of-proc.patch +Patch6007: backport-su-bash-completion-offer-usernames-rather-than-files.patch +Patch6008: backport-Fix-memory-leaks-in-the-chcpu.patch +Patch6009: backport-logger-fix-prio-prefix-doesn-t-use-priority-default.patch +Patch6010: backport-vipw-flush-stdout-before-getting-answer.patch +Patch6011: backport-login-Restore-tty-size-after-calling-vhangup.patch +Patch6012: backport-Forward-value-of-sector_size-instead-of-its-address.patch +Patch6013: backport-libfdisk-dereference-of-possibly-NULL-gcc-analyzer.patch +Patch6014: backport-libfdisk-check-calloc-return-gcc-analyzer.patch +Patch6015: backport-mcookie-fix-infinite-loop-when-use-f.patch +Patch6016: backport-sfdisk-write-empty-label-also-when-only-ignored-part.patch +Patch6017: backport-fstat-dir-itself.patch +Patch6018: backport-libblkid-src-topology-dm-close-redundant-write-file-.patch +Patch6019: backport-libblkid-topology-init-variables-for-DM.patch +Patch6020: backport-sfdisk-fix-typo-in-move-data-when-check-partition-size.patch +Patch6021: backport-losetup-fix-memory-leak-asan.patch +Patch6022: backport-partx-remove-memory-leak-to-make-scanners-happy-coverity-scan.patch +Patch6023: backport-lib-path-make-ul_path_read_buffer-more-robust-coverity-scan.patch +Patch6024: backport-libmount-fix-possible-memory-leak-in-mnt_optstr_fix_secontext-coverity-scan.patch +Patch6025: backport-libblkid-probe-fix-size-and-offset-overflows-fuzzing.patch +Patch6026: backport-lslogins-improve-prefixes-interpretation.patch +Patch6027: backport-lsns-fix-the-memory-leak.patch +Patch6028: backport-libblkid-check-fsync-return-code.patch +Patch6029: backport-libblkid-mac-make-sure-block-size-is-large-enough-fuzzing.patch +Patch6030: backport-libblkid-bsd-fix-buffer-pointer-use-fuzzing.patch +Patch6031: backport-libblkid-hfs-fix-label-use-fuzzing.patch +Patch6032: backport-Maybe-there-is-a-little-mistake-in-do_taskset-functi.patch +Patch6033: backport-lsblk-fix-endless-loop-if-device-specified-more-than-once.patch +Patch6034: backport-libblkid-avoid-buffer-overflow-in-ocfs-superblock-parsing.patch +Patch6035: backport-fsck-Processes-may-kill-other-processes.patch +Patch6036: backport-fdisk-fix-output-option-parsing.patch +Patch6037: backport-libblkid-exfat-fix-divide-by-zero-coverity-scan.patch +Patch6038: backport-llib-pty-session-split-PTY-and-signalfd-setup.patch +Patch6039: backport-script-fix-use-of-utempter.patch +Patch6040: backport-logger-always-update-header-when-read-from-stdin.patch +Patch6041: backport-libblkid-use-checksum-for-jmicron.patch +Patch6042: backport-libblkid-cleanup-indentation.patch +Patch6043: backport-libblkid-fix-jmicron-checksum-and-LE-to-CPU.patch +Patch6044: backport-libblkid-fix-misaligned-address-in-probe_exfat.patch +Patch6045: backport-ldattach-fix-intro-command-and-pause.patch +Patch6046: backport-iso9660.h-use-more-correct-function-types.patch +Patch6047: backport-iso9660.h-avoid-undefined-signed-integer-shift.patch +Patch6048: backport-ipc_msg_get_limits-always-initialize-memory.patch +Patch6049: backport-wdctl-mark-flags-field-as-unsigned-long.patch +Patch6050: backport-login-never-send-signals-to-init.patch +Patch6051: backport-mkswap-do-not-use-uninitialized-stack-value.patch +Patch6052: backport-lib-pager-fix-signal-safety-issues.patch +Patch6053: backport-libblkid-nvidia_raid-verify-superblock-size.patch +Patch6054: backport-libblkid-nvidia_raid-validate-checksum.patch + +Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch +Patch9001: SKIPPED-no-root-permissions-test.patch +%ifarch sw_64 +Patch9002: util-linux-Add-sw64-architecture.patch +%endif BuildRequires: audit-libs-devel >= 1.0.6 gettext-devel libselinux-devel ncurses-devel pam-devel zlib-devel popt-devel BuildRequires: libutempter-devel systemd-devel systemd libuser-devel libcap-ng-devel python3-devel gcc @@ -156,6 +204,7 @@ %define _build_arg1__ SUID_LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now" DAEMON_CFLAGS="$SUID_CFLAGS" DAEMON_LDFLAGS="$SUID_LDFLAGS" unset LINGUAS || : +# del support enable-raw https://github.com/torvalds/linux/commit/603e4922f1c81fc2ed3a87b4f91a8d3aafc7e093 %configure \ --with-systemdsystemunitdir=%{_unitdir} \ --disable-silent-rules \ @@ -164,7 +213,7 @@ --enable-chfn-chsh \ --enable-usrdir-path \ --enable-write \ - --enable-raw \ + --disable-raw \ --enable-hardlink \ --with-python=3 \ --with-systemd \ @@ -177,6 +226,7 @@ %make_build %{_build_arg0__} %{_build_arg1__} %check +export TS_OPT_misc_setarch_known_fail="yes" make check %install @@ -185,7 +235,6 @@ install -d %{buildroot}%{_sysconfdir}/pam.d install -d %{buildroot}{/run/uuidd,/var/lib/libuuid,/var/log} -mv %{buildroot}%{_sbindir}/raw %{buildroot}%{_bindir}/raw install -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pam.d/login install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/pam.d/remote install -m644 %{SOURCE3} %{buildroot}%{_sysconfdir}/pam.d/chsh @@ -203,7 +252,6 @@ touch %{buildroot}/var/log/lastlog chmod 0644 %{buildroot}/var/log/lastlog -echo ".so man8/raw.8" > %{buildroot}%{_mandir}/man8/rawdevices.8 echo ".so man8/hwclock.8" > %{buildroot}%{_mandir}/man8/clock.8 %find_lang %name @@ -307,7 +355,7 @@ %{_bindir}/{cal,chrt,col,colcrt,colrm,column,chmem,dmesg,eject,fallocate,fincore,findmnt,choom,uclampset} %{_bindir}/{flock,getopt,hexdump,ionice,ipcmk,ipcrm,ipcs,isosize,kill,last,lastb,logger,hardlink} %{_bindir}/{look,lsblk,lscpu,lsipc,lslocks,lslogins,lsmem,lsns,mcookie,mesg,more,mountpoint} -%{_bindir}/{namei,nsenter,prlimit,raw,rename,renice,rev,script,scriptreplay,setarch,setpriv} +%{_bindir}/{namei,nsenter,prlimit,rename,renice,rev,script,scriptreplay,setarch,setpriv} %{_bindir}/{setsid,setterm,taskset,ul,unshare,utmpdump,uuidgen,uuidparse,wdctl,whereis,scriptlive,irqtop,lsirq} %{_sbindir}/{addpart,agetty,blkdiscard,blkid,blkzone,blockdev,chcpu,ctrlaltdel,delpart,fdisk} %{_sbindir}/{findfs,fsck,fsck.cramfs,fsck.minix,fsfreeze,fstrim,ldattach,losetup,mkfs,mkfs.cramfs} @@ -320,7 +368,7 @@ %{compldir}/{fstrim,getopt,hexdump,ionice,ipcmk,ipcrm,ipcs,isosize,last,ldattach} %{compldir}/{logger,look,losetup,lsblk,lscpu,lsipc,lslocks,lslogins,lsmem,lsns} %{compldir}/{mcookie,mesg,mkfs,mkfs.cramfs,mkfs.minix,mkswap,more,mountpoint} -%{compldir}/{namei,nsenter,partx,pivot_root,prlimit,raw,readprofile,rename,renice} +%{compldir}/{namei,nsenter,partx,pivot_root,prlimit,readprofile,rename,renice} %{compldir}/{resizepart,rev,rfkill,rtcwake,runuser,script,scriptreplay,setarch} %{compldir}/{setpriv,setsid,setterm,su,swaplabel,swapoff,swapon,taskset,ul,unshare} %{compldir}/{utmpdump,uuidgen,uuidparse,wall,wdctl,whereis,wipefs,write,zramctl} @@ -390,38 +438,130 @@ %{_mandir}/man8/{blkdiscard.8*,blkid.8*,blkzone.8*,blockdev.8*,chcpu.8*,chmem.8*,ctrlaltdel.8*,delpart.8*} %{_mandir}/man8/{fdisk.8*,findfs.8*,findmnt.8*,fsck.8*,fsck.cramfs.8*,fsck.minix.8*,fsfreeze.8*,fstrim.8*} %{_mandir}/man8/{isosize.8*,ldattach.8*,losetup.8*,lsblk.8*,lslocks.8*,lsns.8*,mkfs.8*,mkfs.cramfs.8*} -%{_mandir}/man8/{mkfs.minix.8*,mkswap.8*,mount.8*,nologin.8*,partx.8*,pivot_root.8*,raw.8*,rawdevices.8*} +%{_mandir}/man8/{mkfs.minix.8*,mkswap.8*,mount.8*,nologin.8*,partx.8*,pivot_root.8*} %{_mandir}/man8/{readprofile.8*,resizepart.8*,rfkill.8*,rtcwake.8*,setarch.8*,sulogin.8.gz,swaplabel.8*} %{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*} %changelog -* Wed Jun 29 2022 shangyibin <shangyibin1@h-partners.com> - 2.37.2-5 +* Thu Mar 16 2023 zhangyao <zhangyao108@huawei.com> - 2.37.2-17 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:nvidia_raid: validate checksum + add backport-libblkid-nvidia_raid-verify-superblock-size.patch + backport-libblkid-nvidia_raid-validate-checksum.patch + +* Wed Mar 8 2023 zhangyao <zhangyao108@huawei.com> - 2.37.2-16 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:sync community patches + add backport-libblkid-fix-misaligned-address-in-probe_exfat.patch + backport-ldattach-fix-intro-command-and-pause.patch + backport-iso9660.h-use-more-correct-function-types.patch + backport-iso9660.h-avoid-undefined-signed-integer-shift.patch + backport-ipc_msg_get_limits-always-initialize-memory.patch + backport-wdctl-mark-flags-field-as-unsigned-long.patch + backport-login-never-send-signals-to-init.patch + backport-mkswap-do-not-use-uninitialized-stack-value.patch + backport-lib-pager-fix-signal-safety-issues.patch + +* Wed Mar 1 2023 zhangyao <zhangyao108@huawei.com> - 2.37.2-15 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:use checksum for jmicron + +* Tue Jan 31 2023 yangchenguang <yangchenguang@uniontech.com> - 2.37.2-14 - Type:bugfix - ID:NA - SUG:NA -- DESC:Fallback to move hexdump from util-linux to util-linux-devel - Fallback solve yum failure because of files conflicts +- DESC: delete support enable-raw -* Mon Jun 20 2022 shangyibin <shangyibin1@h-partners.com> - 2.37.2-4 +* Sat Sep 17 2022 zhangyao <zhangyao108@huawei.com> - 2.37.2-13 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:sync community patches + addbackport-fsck-Processes-may-kill-other-processes.patch + backport-fdisk-fix-output-option-parsing.patch + backport-libblkid-exfat-fix-divide-by-zero-coverity-scan.patch + backport-llib-pty-session-split-PTY-and-signalfd-setup.patch + backport-script-fix-use-of-utempter.patch + backport-logger-always-update-header-when-read-from-stdin.patch + +* Mon Nov 14 2022 zhangyao<zhangyao108@hhuawei.com> - 2.37.2-12 - Type:bugfix - ID:NA - SUG:NA -- DESC:sync patches - move hexdump from util-linux to util-linux-devel - solve yum failure because of files conflicts +- DESC:Sync community patches + addbackport-lsblk-fix-endless-loop-if-device-specified-more-than-once.patch + backport-libblkid-avoid-buffer-overflow-in-ocfs-superblock-parsing.patch -* Wed Jun 15 2022 shangyibin <shangyibin1@h-partners.com> - 2.37.2-3 +* Tue Nov 8 2022 zhangyao<zhangyao108@hhuawei.com> - 2.37.2-11 - Type:bugfix - ID:NA - SUG:NA -- DESC:fix test fail +- DESC:Sync community patches + +* Wed Nov 2 2022 January <1398871225@qq.com> - 2.37.2-10 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix fdisk command hung on read pipe when dmsetup command failed and initialize local variables + addbackport-libblkid-src-topology-dm-close-redundant-write-file-.patch + backport-libblkid-topology-init-variables-for-DM.patch + +* Wed Oct 26 2022 wuzx<wuzx1226@qq.com> - 2.37.2-9 +- Type:feature +- CVE:NA +- SUG:NA +- DESC:Add sw64 architecture + +* Sat Jul 30 2022 zhangyao<zhangyao108@hhuawei.com> - 2.37.2-8 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Sync community patches -* Thu Jun 09 2022 renhongxun<renhongxun@h-partners.com> - 2.37.2-2 +* Thu Jun 30 2022 shangyibin<shangyibin1@h-partners.com> - 2.37.2-7 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Sync community patches + +* Wed Jun 08 2022 renhongxun<renhongxun@h-partners.com> - 2.37.2-6 - Type:bugfix - ID:NA - SUG:NA - DESC:move hardlink/uclampset completions from util-linux-help to util-linux +* Sat Feb 19 2022 shangyibin<shangyibin1@h-partners.com> - 2.37.2-5 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix by ignoring EINVAL on remount of proc + +* Fri Feb 18 2022 shangyibin<shangyibin1@h-partners.com> - 2.37.2-4 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:realloc buffer when header size changed + fix size use for stdin + segmentation fault on invalid unicode input passed to -s option + +* Mon Feb 14 2022 shangyibin<shangyibin1@h-partners.com> - 2.37.2-3 +- Type:CVE +- ID:CVE-2021-3995 CVE-2021-3996 +- SUG:NA +- DESC:fix CVE-2021-3995 CVE-2021-3996 + +* Mon Jan 10 2022 shangyibin <shangyibin1@huawei.com> - 2.37.2-2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix test fail + * Mon Dec 27 2021 tianwei <tianwei12@huawei.com> - 2.37.2-1 - Type:enhancement - ID:NA
View file
_service:tar_scm:backport-CVE-2021-3995.patch
Added
@@ -0,0 +1,138 @@ +From f3db9bd609494099f0c1b95231c5dfe383346929 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +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); +- destnmax-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 uidstrsizeof(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 bufsizeof(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 +
View file
_service:tar_scm:backport-CVE-2021-3996.patch
Added
@@ -0,0 +1,226 @@ +From 018a10907fa9885093f6d87401556932c2d8bd2b Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +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 +
View file
_service:tar_scm:backport-Maybe-there-is-a-little-mistake-in-do_taskset-functi.patch
Added
@@ -0,0 +1,26 @@ +From 6ff67988785af818b97a7175c8ca80f2ee2d039f Mon Sep 17 00:00:00 2001 +From: csbo98 <boliu98@foxmail.com> +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 +
View file
_service:tar_scm:backport-fdisk-fix-output-option-parsing.patch
Added
@@ -0,0 +1,28 @@ +From 55ef593842d94d657c8209042491c7590ea3bdf0 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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 +
View file
_service:tar_scm:backport-fix-by-ignoring-EINVAL-on-remount-of-proc.patch
Added
@@ -0,0 +1,40 @@ +From 1961dccea09176a401bc8fc5e1769ab426308314 Mon Sep 17 00:00:00 2001 +From: benaryorg <binary@benary.org> +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 <binary@benary.org> +--- + 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); + }
View file
_service:tar_scm:backport-fsck-Processes-may-kill-other-processes.patch
Added
@@ -0,0 +1,35 @@ +From 240f2ea95724a2045afebef703f9a7e62326b603 Mon Sep 17 00:00:00 2001 +From: zhanchengbin <zhanchengbin1@huawei.com> +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 <zhanchengbin1@huawei.com> +Reviewed-by: Lukas Czerner <lczerner@redhat.com> +--- + 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 +
View file
_service:tar_scm:backport-fstat-dir-itself.patch
Added
@@ -0,0 +1,34 @@ +From 2f26f8aae1ece618ff7ade997609509f0b60d400 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Mon, 6 Sep 2021 11:52:09 +0200 +Subject: PATCH lib/path: fstat dir itself + +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + 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 +
View file
_service:tar_scm:backport-ipc_msg_get_limits-always-initialize-memory.patch
Added
@@ -0,0 +1,25 @@ +From 970ed62e716d1cb347e983c9a96647be5455e713 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de> +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 +
View file
_service:tar_scm:backport-iso9660.h-avoid-undefined-signed-integer-shift.patch
Added
@@ -0,0 +1,37 @@ +From 893fe60d0b8f14d9a3022f6f95637e43b17f1b8b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de> +Date: Tue, 13 Dec 2022 02:40:02 +0000 +Subject: PATCH iso9660.h: avoid undefined signed integer shift + +When the high bit in p3 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 ((p0 & 0xff) + | ((p1 & 0xff) << 8) + | ((p2 & 0xff) << 16) +- | ((p3 & 0xff) << 24)); ++ | (((uint32_t) p3 & 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 ((p3 & 0xff) + | ((p2 & 0xff) << 8) + | ((p1 & 0xff) << 16) +- | ((p0 & 0xff) << 24)); ++ | (((uint32_t) p0 & 0xff) << 24)); + } + + static inline uint32_t isonum_733(const unsigned char *p, bool check_match) +-- +2.27.0 +
View file
_service:tar_scm:backport-iso9660.h-use-more-correct-function-types.patch
Added
@@ -0,0 +1,80 @@ +From 9fc18efe956956be078fbbcea2144f0bb1b33b30 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de> +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 <stdbool.h> ++#include <stdint.h> + + #include "c.h" + +-static inline int isonum_721(unsigned char *p) ++static inline uint16_t isonum_721(const unsigned char *p) + { + return ((p0 & 0xff) + | ((p1 & 0xff) << 8)); + } + +-static inline int isonum_722(unsigned char *p) ++static inline uint16_t isonum_722(const unsigned char *p) + { + return ((p1 & 0xff) + | ((p0 & 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 ((p0 & 0xff) + | ((p1 & 0xff) << 8) +@@ -36,7 +37,7 @@ static inline int isonum_731(unsigned char *p) + | ((p3 & 0xff) << 24)); + } + +-static inline int isonum_732(unsigned char *p) ++static inline uint32_t isonum_732(const unsigned char *p) + { + return ((p3 & 0xff) + | ((p2 & 0xff) << 8) +@@ -44,10 +45,10 @@ static inline int isonum_732(unsigned char *p) + | ((p0 & 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 +
View file
_service:tar_scm:backport-ldattach-fix-intro-command-and-pause.patch
Added
@@ -0,0 +1,31 @@ +From 5bd28f494ece506daa58861bf46e726c3958021e Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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 +
View file
_service:tar_scm:backport-lib-pager-fix-signal-safety-issues.patch
Added
@@ -0,0 +1,39 @@ +From 518a0ad4d9c586ca69d3cf924a4328361f6b2a80 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org> +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 +
View file
_service:tar_scm:backport-lib-path-make-ul_path_read_buffer-more-robust-coverity-scan.patch
Added
@@ -0,0 +1,42 @@ +From ea459dcf95d0bb04c816b71d2b85fbcd8cfc5ee4 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 bufrc - 1 for rc=0. + +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + 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 +- bufrc - 1 = '\0'; ++ if (rc == 0) ++ buf0 = '\0'; ++ ++ else if (rc > 0) { ++ /* Remove tailing newline (usual in sysfs) */ ++ if (*(buf + rc - 1) == '\n') ++ buf--rc = '\0'; ++ else ++ bufrc - 1 = '\0'; ++ } + + return rc; + }
View file
_service:tar_scm:backport-libblkid-avoid-buffer-overflow-in-ocfs-superblock-parsing.patch
Added
@@ -0,0 +1,39 @@ +From d7fa8ed63891b0058c5df8aa809e34de61008f51 Mon Sep 17 00:00:00 2001 +From: Milan Broz <gmazyland@gmail.com> +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 <gmazyland@gmail.com> +--- + 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;
View file
_service:tar_scm:backport-libblkid-bsd-fix-buffer-pointer-use-fuzzing.patch
Added
@@ -0,0 +1,24 @@ +From 0a0630133055c3b3daa3072a3fd9944a1a149401 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Thu, 2 Jun 2022 16:02:54 +0200 +Subject: PATCH libblkid: (bsd) fix buffer pointer use fuzzing + +Reported-by: Thibault Guittet <tguittet@redhat.com> +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + 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)
View file
_service:tar_scm:backport-libblkid-check-fsync-return-code.patch
Added
@@ -0,0 +1,59 @@ +From 133a0d70f637b4f4e4337811e452153b04f2bdcf Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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 +
View file
_service:tar_scm:backport-libblkid-cleanup-indentation.patch
Added
@@ -0,0 +1,32 @@ +From c7471d8b3d4e796eee8ae041e5cbb55c5619318e Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Wed, 19 Oct 2022 11:24:30 +0200 +Subject: PATCH libblkid: cleanup indentation + +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + 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 signature2; /* 0x0 - 0x01 */ +-- +2.27.0 +
View file
_service:tar_scm:backport-libblkid-exfat-fix-divide-by-zero-coverity-scan.patch
Added
@@ -0,0 +1,26 @@ +From 48229f8e7f19c1b61a089fc9ede18d417a895454 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Mon, 24 Oct 2022 10:54:24 +0200 +Subject: PATCH libblkid: (exfat) fix divide by zero coverity scan + +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + 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 +
View file
_service:tar_scm:backport-libblkid-fix-jmicron-checksum-and-LE-to-CPU.patch
Added
@@ -0,0 +1,92 @@ +From cb92f0d82ae634e46989d3dae673ae3f542f7dd9 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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->sparei); ++ jm->sparei = le32_to_cpu(jm->sparei); + + for (i = 0; i < JM_MEMBERS; i++) +- le32_to_cpu(jm->memberi); ++ jm->memberi = le32_to_cpu(jm->memberi); + } + +-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 +
View file
_service:tar_scm:backport-libblkid-fix-misaligned-address-in-probe_exfat.patch
Added
@@ -0,0 +1,42 @@ +From 2a71e291d0fe247d7ca62775e47865dda4b2acfd Mon Sep 17 00:00:00 2001 +From: Milan Broz <gmazyland@gmail.com> +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 +
View file
_service:tar_scm:backport-libblkid-hfs-fix-label-use-fuzzing.patch
Added
@@ -0,0 +1,27 @@ +From 74e48269ee9a15e230e25d0e3d2e50f5b0ba2b04 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Thu, 2 Jun 2022 16:02:54 +0200 +Subject: PATCH libblkid: (hfs) fix label use fuzzing + +Reported-by: Thibault Guittet <tguittet@redhat.com> +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + 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; + } +
View file
_service:tar_scm:backport-libblkid-mac-make-sure-block-size-is-large-enough-fuzzing.patch
Added
@@ -0,0 +1,25 @@ +From 4e12fbca62be10b09503cecc7507757874043474 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <tguittet@redhat.com> +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + 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.
View file
_service:tar_scm:backport-libblkid-nvidia_raid-validate-checksum.patch
Added
@@ -0,0 +1,55 @@ +From 8a08c34aad61cb59c977212458bf55f5a81186e8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de> +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 <thomas@t-8ch.de> +--- + 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 +
View file
_service:tar_scm:backport-libblkid-nvidia_raid-verify-superblock-size.patch
Added
@@ -0,0 +1,38 @@ +From d8d164db5ee217034dea7788263b532114bcd2fd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de> +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 <thomas@t-8ch.de> +--- + 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 +
View file
_service:tar_scm:backport-libblkid-probe-fix-size-and-offset-overflows-fuzzing.patch
Added
@@ -0,0 +1,51 @@ +From 106de261469e1001243d5b81ed895762fb34b2ba Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Thu, 2 Jun 2022 16:02:54 +0200 +Subject: PATCH libblkid: (probe) fix size and offset overflows fuzzing + +Reported-by: Thibault Guittet <tguittet@redhat.com> +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + 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; + }
View file
_service:tar_scm:backport-libblkid-src-topology-dm-close-redundant-write-file-.patch
Added
@@ -0,0 +1,47 @@ +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 (dmpipe1 != -1) { ++ close(dmpipe1); ++ } ++ + 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(dmpipe1); + return 0; + + nothing: +@@ -119,8 +122,6 @@ nothing: + fclose(stream); + else if (dmpipe0 != -1) + close(dmpipe0); +- if (dmpipe1 != -1) +- close(dmpipe1); + return 1; + } + +-- +2.31.1 +
View file
_service:tar_scm:backport-libblkid-topology-init-variables-for-DM.patch
Added
@@ -0,0 +1,34 @@ +From 819210f37d66949f54fb2f830bc62cb3635a83d5 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> + +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 +
View file
_service:tar_scm:backport-libblkid-use-checksum-for-jmicron.patch
Added
@@ -0,0 +1,122 @@ +From cf68e2c897a29f8a3a1c8402574bbb49adf5a52a Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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 signature2; +- uint8_t minor_version; +- uint8_t major_version; +- uint16_t checksum; +-}; ++ int8_t signature2; /* 0x0 - 0x01 */ + +-#define JM_SIGNATURE "JM" ++ uint16_t version; /* 0x03 - 0x04 JMicron version */ ++ ++ uint16_t checksum; /* 0x04 - 0x05 */ ++ uint8_t filler10; ++ ++ 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 name16; /* 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 filler14; ++ ++ uint32_t spareJM_SPARES; /* 0x38 - 0x3F */ ++ uint32_t memberJM_MEMBERS; /* 0x40 - 0x5F */ ++ ++ uint8_t filler20x20; ++} __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->sparei); ++ ++ for (i = 0; i < JM_MEMBERS; i++) ++ le32_to_cpu(jm->memberi); ++} ++ ++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 +
View file
_service:tar_scm:backport-libmount-fix-possible-memory-leak-in-mnt_optstr_fix_secontext-coverity-scan.patch
Added
@@ -0,0 +1,37 @@ +ssFrom fbc09df31a1f89b02ae13b21c949728ad82f5713 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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 +
View file
_service:tar_scm:backport-llib-pty-session-split-PTY-and-signalfd-setup.patch
Added
@@ -0,0 +1,121 @@ +From 4681d88ba1034d488814bbbb6e7d06d17e33322d Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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 +
View file
_service:tar_scm:backport-logger-always-update-header-when-read-from-stdin.patch
Added
@@ -0,0 +1,98 @@ +From 96ccdc00e1fcf1684f9734a189baf90e00ff0c9a Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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 = "<someone>"; +- +- 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) + } + bufi = '\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 <arg> reopens stdin making the below + * function to be used for file inputs. */ + logger_stdin(&ctl); ++ + logger_close(&ctl); + return EXIT_SUCCESS; + } +-- +2.27.0 +
View file
_service:tar_scm:backport-login-never-send-signals-to-init.patch
Added
@@ -0,0 +1,41 @@ +From 4bbda92cdd0ceacc982f759d97d35b1617a8beba Mon Sep 17 00:00:00 2001 +From: Samanta Navarro <ferivoz@riseup.net> +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 <ferivoz@riseup.net> +--- + 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 +
View file
_service:tar_scm:backport-losetup-fix-memory-leak-asan.patch
Added
@@ -0,0 +1,23 @@ +From 01dd2838b4f60888fc66ccb9aa0f44907d1851a4 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Tue, 8 Mar 2022 13:06:45 +0100 +Subject: PATCH losetup: fix memory leak asan + +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + 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)
View file
_service:tar_scm:backport-lsblk-fix-endless-loop-if-device-specified-more-than-once.patch
Added
@@ -0,0 +1,41 @@ +From 9eb31ca7f7971101846bd3668be5d7807200fa2f Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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); +
View file
_service:tar_scm:backport-lslogins-improve-prefixes-interpretation.patch
Added
@@ -0,0 +1,88 @@ +From c51cba1e838ae7e36a843ec785543492bb8737cd Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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
View file
_service:tar_scm:backport-lsns-fix-the-memory-leak.patch
Added
@@ -0,0 +1,100 @@ +From 395f3baed6df1eb736c872ecaa3aa2f05c5dc111 Mon Sep 17 00:00:00 2001 +From: lishengyu <lishengyu@uniontech.com> +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 +
View file
_service:tar_scm:backport-mkswap-do-not-use-uninitialized-stack-value.patch
Added
@@ -0,0 +1,46 @@ +From 6c88722c175adca5b1a72bcc770f94674405b7f4 Mon Sep 17 00:00:00 2001 +From: Samanta Navarro <ferivoz@riseup.net> +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 <ferivoz@riseup.net> +--- + 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 +
View file
_service:tar_scm:backport-partx-remove-memory-leak-to-make-scanners-happy-coverity-scan.patch
Added
@@ -0,0 +1,32 @@ +From 9ae0289e8142097f4d3cf91bd4d1f2a5621914c7 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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); +
View file
_service:tar_scm:backport-script-fix-use-of-utempter.patch
Added
@@ -0,0 +1,43 @@ +From 6ed644fbf4869a7e042826900eff531cf6660cfb Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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 +
View file
_service:tar_scm:backport-sfdisk-fix-typo-in-move-data-when-check-partition-size.patch
Added
@@ -0,0 +1,26 @@ +From b383155ac6a94f14f5c661d2e4a62c1eef5b6e27 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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 +
View file
_service:tar_scm:backport-wdctl-mark-flags-field-as-unsigned-long.patch
Added
@@ -0,0 +1,43 @@ +From f36f3251c564991070c6b2c2347a999a56564e63 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de> +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 +
View file
_service:tar_scm:fix-size-use-for-stdin.patch
Added
@@ -0,0 +1,61 @@ +From 58e4ee082bca100034791a4a74481f263bb30a25 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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) { + bufi++ = c; + c = getchar(); + }
View file
_service:tar_scm:realloc-buffer-when-header-size-changed.patch
Added
@@ -0,0 +1,64 @@ +From b0a8b8cd9c34600dda7d0503aac2dc0af3012fdc Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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) + } + bufi = '\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();
View file
_service:tar_scm:segmentation-fault-on-invalid-unicode-input-passed-to-s-option.patch
Added
@@ -0,0 +1,27 @@ +From 9714331843ef3a6d9c10ff1d3bc5fcf53d44d930 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +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 <kzak@redhat.com> +--- + 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':
View file
_service:tar_scm:util-linux-Add-sw64-architecture.patch
Added
@@ -0,0 +1,326 @@ +From f59cfb87a948b2fb9c18ab059b74b9141419643a Mon Sep 17 00:00:00 2001 +From: wzx <wuzx1226@qq.com> +Date: Wed, 26 Oct 2022 09:53:14 +0800 +Subject: PATCH Add sw64 architecture + +Signed-off-by: wzx <wuzx1226@qq.com> +--- + configure | 2 ++ + configure.ac | 2 ++ + include/pt-bsd.h | 4 ++-- + libblkid/src/partitions/bsd.c | 1 + + libfdisk/src/bsd.c | 16 ++++++++-------- + sys-utils/hwclock-rtc.c | 2 +- + sys-utils/hwclock.c | 12 ++++++------ + sys-utils/hwclock.h | 6 +++--- + sys-utils/lscpu-cputype.c | 2 +- + sys-utils/setarch.c | 4 ++++ + tests/ts/fdisk/bsd | 5 ++++- + 11 files changed, 34 insertions(+), 22 deletions(-) + +diff --git a/configure b/configure +index 57b830a..48d3a36 100755 +--- a/configure ++++ b/configure +@@ -36071,6 +36071,7 @@ else + case $host_cpu in + #( + alpha) syscall="442" ;; #( ++ sw_64) syscall="442" ;; #( + i*86) syscall="289" ;; #( + ia64*) syscall="1274" ;; #( + powerpc*) syscall="273" ;; #( +@@ -36175,6 +36176,7 @@ else + case $host_cpu in + #( + alpha) syscall="443" ;; #( ++ sw_64) syscall="443" ;; #( + i*86) syscall="290" ;; #( + ia64*) syscall="1275" ;; #( + powerpc*) syscall="274" ;; #( +diff --git a/configure.ac b/configure.ac +index b12b48c..bf405da 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2218,6 +2218,7 @@ UL_BUILD_INIT(ionice) + UL_REQUIRES_SYSCALL_CHECK(ionice, + UL_CHECK_SYSCALL(ioprio_set, + alpha, 442, ++ sw_64, 442, + i*86, 289, + ia64*, 1274, + powerpc*, 273, +@@ -2230,6 +2231,7 @@ UL_REQUIRES_SYSCALL_CHECK(ionice, + UL_REQUIRES_SYSCALL_CHECK(ionice, + UL_CHECK_SYSCALL(ioprio_get, + alpha, 443, ++ sw_64, 443, + i*86, 290, + ia64*, 1275, + powerpc*, 274, +diff --git a/include/pt-bsd.h b/include/pt-bsd.h +index 9bf47a5..c524c44 100644 +--- a/include/pt-bsd.h ++++ b/include/pt-bsd.h +@@ -10,7 +10,7 @@ + + #define BSD_LINUX_BOOTDIR "/usr/ucb/mdec" + +-#if defined (__alpha__) || defined (__powerpc__) || \ ++#if defined (__alpha__) || defined (__sw_64__) || defined (__powerpc__) || \ + defined (__ia64__) || defined (__hppa__) + # define BSD_LABELSECTOR 0 + # define BSD_LABELOFFSET 64 +@@ -137,7 +137,7 @@ struct bsd_disklabel { + #define BSD_FS_ADVFS 16 /* Digital Unix AdvFS */ + + /* this is annoying, but it's also the way it is :-( */ +-#ifdef __alpha__ ++#if defined __alpha__ || defined __sw_64__ + #define BSD_FS_EXT2 8 /* ext2 file system */ + #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 +--- a/libblkid/src/partitions/bsd.c ++++ b/libblkid/src/partitions/bsd.c +@@ -166,6 +166,7 @@ nothing: + * ------------------------+-------------+------------ + * alpha luna88k mac68k | 0 | 64 + * sparc(OpenBSD) vax | | ++ * sw_64 | | + * ------------------------+-------------+------------ + * sparc64 sparc(NetBSD) | 0 | 128 + * ------------------------+-------------+------------ +diff --git a/libfdisk/src/bsd.c b/libfdisk/src/bsd.c +index 313ae5a..875fa11 100644 +--- a/libfdisk/src/bsd.c ++++ b/libfdisk/src/bsd.c +@@ -55,7 +55,7 @@ static struct fdisk_parttype bsd_fstypes = { + {BSD_FS_V71K, "4.1BSD"}, + {BSD_FS_V8, "Eighth Edition"}, + {BSD_FS_BSDFFS, "4.2BSD"}, +-#ifdef __alpha__ ++#if defined __alpha__ || defined __sw_64__ + {BSD_FS_EXT2, "ext2"}, + #else + {BSD_FS_MSDOS, "MS-DOS"}, +@@ -80,7 +80,7 @@ struct fdisk_bsd_label { + + struct dos_partition *dos_part; /* parent */ + struct bsd_disklabel bsd; /* on disk label */ +-#if defined (__alpha__) ++#if defined (__alpha__) || defined (__sw_64__) + /* We access this through a u_int64_t * when checksumming */ + char bsdbufferBSD_BBSIZE __attribute__((aligned(8))); + #else +@@ -120,7 +120,7 @@ static struct fdisk_parttype *bsd_partition_parttype( + } + + +-#if defined (__alpha__) ++#if defined (__alpha__) || defined (__sw_64__) + static void alpha_bootblock_checksum (char *boot) + { + uint64_t *dp = (uint64_t *) boot, sum = 0; +@@ -606,7 +606,7 @@ int fdisk_bsd_edit_disklabel(struct fdisk_context *cxt) + struct bsd_disklabel *d = self_disklabel(cxt); + uintmax_t res; + +-#if defined (__alpha__) || defined (__ia64__) ++#if defined (__alpha__) || defined (__sw_64__) || defined (__ia64__) + if (fdisk_ask_number(cxt, DEFAULT_SECTOR_SIZE, d->d_secsize, + UINT32_MAX, _("bytes/sector"), &res) == 0) + d->d_secsize = res; +@@ -712,7 +712,7 @@ int fdisk_bsd_write_bootstrap(struct fdisk_context *cxt) + sector = 0; + if (l->dos_part) + sector = dos_partition_get_start(l->dos_part); +-#if defined (__alpha__) ++#if defined (__alpha__) || defined (__sw_64__) + alpha_bootblock_checksum(l->bsdbuffer); + #endif + if (lseek(cxt->dev_fd, (off_t) sector * DEFAULT_SECTOR_SIZE, SEEK_SET) == -1) { +@@ -769,7 +769,7 @@ static int bsd_initlabel (struct fdisk_context *cxt) + else + d -> d_type = BSD_DTYPE_ST506; + +-#if !defined (__alpha__) ++#if !defined (__alpha__) && !defined (__sw_64__) + d -> d_flags = BSD_D_DOSPART; + #else + d -> d_flags = 0; +@@ -893,7 +893,7 @@ static int bsd_write_disklabel(struct fdisk_context *cxt) + memmove(&l->bsdbufferBSD_LABELSECTOR * DEFAULT_SECTOR_SIZE + + BSD_LABELOFFSET, d, sizeof(*d)); + +-#if defined (__alpha__) && BSD_LABELSECTOR == 0 ++#if (defined (__alpha__) || defined (__sw_64__)) && BSD_LABELSECTOR == 0 + /* Write the checksum to the end of the first sector. */ + alpha_bootblock_checksum(l->bsdbuffer); + #endif +@@ -929,7 +929,7 @@ static int bsd_translate_fstype (int linux_type) + case 0x06: /* DOS 16-bit >=32M */ + case 0xe1: /* DOS access */ + case 0xe3: /* DOS R/O */ +-#if !defined (__alpha__) ++#if !defined (__alpha__) && !defined (__sw_64__) + case 0xf2: /* DOS secondary */ + return BSD_FS_MSDOS; + #endif +diff --git a/sys-utils/hwclock-rtc.c b/sys-utils/hwclock-rtc.c +index 07af9c8..885ca1e 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) + return &rtc_interface; + } + +-#ifdef __alpha__ ++#if defined __alpha__ || defined __sw_64__ + /* + * 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 +--- 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, + * Get or set the kernel RTC driver's epoch on Alpha machines. + * ISA machines are hard coded for 1900. + */ +-#if defined(__linux__) && defined(__alpha__) ++#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__)) + 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")); +-#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")); + #endif +@@ -1188,7 +1188,7 @@ usage(void) + " --directisa use the ISA bus instead of %1$s access\n"), _PATH_RTC_DEV); + puts(_(" --date <time> date/time input for --set and --predict")); + puts(_(" --delay <sec> delay used when set new RTC time")); +-#if defined(__linux__) && defined(__alpha__) ++#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__)) + puts(_(" --epoch <year> epoch input for --setepoch")); + #endif + puts(_(" --update-drift update the RTC drift factor")); +@@ -1250,7 +1250,7 @@ int main(int argc, char **argv) + { "ul-debug", required_argument, NULL, 'd' }, + { "verbose", no_argument, NULL, 'v' }, + { "set", no_argument, NULL, OPT_SET }, +-#if defined(__linux__) && defined(__alpha__) ++#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__)) + { "getepoch", no_argument, NULL, OPT_GETEPOCH }, + { "setepoch", no_argument, NULL, OPT_SETEPOCH }, + { "epoch", required_argument, NULL, OPT_EPOCH }, +@@ -1354,7 +1354,7 @@ int main(int argc, char **argv) + ctl.show = 0; + ctl.hwaudit_on = 1; + break; +-#if defined(__linux__) && defined(__alpha__) ++#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__)) + case OPT_GETEPOCH: + ctl.getepoch = 1; + ctl.show = 0; +@@ -1461,7 +1461,7 @@ int main(int argc, char **argv) + } + } + +-#if defined(__linux__) && defined(__alpha__) ++#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__)) + if (ctl.getepoch || ctl.setepoch) { + manipulate_epoch(&ctl); + hwclock_exit(&ctl, EXIT_SUCCESS); +diff --git a/sys-utils/hwclock.h b/sys-utils/hwclock.h +index 627cf51..2c88181 100644 +--- a/sys-utils/hwclock.h ++++ b/sys-utils/hwclock.h +@@ -23,7 +23,7 @@ struct hwclock_control { + char *date_opt; + char *adj_file_name; + double rtc_delay; /* --delay <seconds> */ +-#if defined(__linux__) && defined(__alpha__) ++#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__)) + char *epoch_option; + #endif + #ifdef __linux__ +@@ -36,7 +36,7 @@ struct hwclock_control { + hctosys:1, + utc:1, + systohc:1, +-#if defined(__linux__) && defined(__alpha__) ++#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__)) + getepoch:1, + setepoch:1, + #endif +@@ -69,7 +69,7 @@ extern struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl); + extern double time_diff(struct timeval subtrahend, struct timeval subtractor); + + /* rtc.c */ +-#if defined(__linux__) && defined(__alpha__) ++#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__)) + extern int get_epoch_rtc(const struct hwclock_control *ctl, unsigned long *epoch); + extern int set_epoch_rtc(const struct hwclock_control *ctl); + #endif +diff --git a/sys-utils/lscpu-cputype.c b/sys-utils/lscpu-cputype.c +index 7b5b109..4492a08 100644 +--- a/sys-utils/lscpu-cputype.c ++++ b/sys-utils/lscpu-cputype.c +@@ -596,7 +596,7 @@ struct lscpu_arch *lscpu_read_architecture(struct lscpu_cxt *cxt) + * information about our real CPU */ + ; + else { +-#if defined(__alpha__) || defined(__ia64__) ++#if defined(__alpha__) || defined(__sw_64__) || defined(__ia64__) + ar->bit64 = 1; /* 64bit platforms only */ + #endif + /* platforms with 64bit flag in /proc/cpuinfo, define +diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c +index b86be1e..f25a763 100644 +--- a/sys-utils/setarch.c ++++ b/sys-utils/setarch.c +@@ -187,6 +187,10 @@ static struct arch_domain *init_arch_domains(void) + {PER_LINUX32, "mips", "mips"}, + {PER_LINUX, "mips64", "mips64"}, + #endif ++#if defined(__sw_64__) ++ {PER_LINUX, "sw_64", "sw_64"}, ++ {PER_LINUX, "sw_64sw6b", "sw_64"}, ++#endif + #if defined(__alpha__) + {PER_LINUX, "alpha", "alpha"}, + {PER_LINUX, "alphaev5", "alpha"}, +diff --git a/tests/ts/fdisk/bsd b/tests/ts/fdisk/bsd +index 675468d..bce8706 100755 +--- a/tests/ts/fdisk/bsd ++++ b/tests/ts/fdisk/bsd +@@ -48,7 +48,7 @@ BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order) + ARCH=$(uname -m) + case $ARCH in + # see include/pt-bsd.h +- *alpha* | *ppc* | *ia64* | *hppa* | *parisc* ) ++ *sw_64* | *alpha* | *ppc* | *ia64* | *hppa* | *parisc* ) + BSD_LABELSECTOR=0 + BSD_LABELOFFSET=64 + ;; +@@ -61,6 +61,9 @@ esac + # and contains extra options for alpha + BSD_EXTRA="" + case $ARCH in ++ *sw_64*) ++ BSD_EXTRA="_sw_64" ++ ;; + *alpha*) + BSD_EXTRA="_alpha" + ;; +-- +2.33.0 +
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="scm">git</param> <param name="url">git@gitee.com:src-openeuler/util-linux.git</param> - <param name="revision">4e8f7523369ec48cc634abf5a845a3b2e6307584</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2