!117 sync branch code
From: @zhang-yao-2022 Reviewed-by: @overweight Signed-off-by: @overweight
This commit is contained in:
commit
7912926215
40
backport-fix-by-ignoring-EINVAL-on-remount-of-proc.patch
Normal file
40
backport-fix-by-ignoring-EINVAL-on-remount-of-proc.patch
Normal file
@ -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);
|
||||
}
|
||||
34
backport-fstat-dir-itself.patch
Normal file
34
backport-fstat-dir-itself.patch
Normal file
@ -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
|
||||
|
||||
61
fix-size-use-for-stdin.patch
Normal file
61
fix-size-use-for-stdin.patch
Normal file
@ -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) {
|
||||
buf[i++] = c;
|
||||
c = getchar();
|
||||
}
|
||||
64
realloc-buffer-when-header-size-changed.patch
Normal file
64
realloc-buffer-when-header-size-changed.patch
Normal file
@ -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)
|
||||
}
|
||||
buf[i] = '\0';
|
||||
|
||||
- if (i > 0 || !ctl->skip_empty_lines) {
|
||||
- if (!has_header)
|
||||
- generate_syslog_header(ctl);
|
||||
+ if (i > 0 || !ctl->skip_empty_lines)
|
||||
write_output(ctl, buf);
|
||||
- has_header = 0;
|
||||
- }
|
||||
|
||||
if (c == '\n') /* discard line terminator */
|
||||
c = getchar();
|
||||
@ -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':
|
||||
@ -1,9 +1,9 @@
|
||||
%define compldir %{_datadir}/bash-completion/completions/
|
||||
%global upstream_major 2.36
|
||||
%global upstream_major 2.37
|
||||
|
||||
Name: util-linux
|
||||
Version: 2.37.2
|
||||
Release: 4
|
||||
Release: 8
|
||||
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
|
||||
@ -21,16 +21,21 @@ Source9: util-linux-runuser-l.pamd
|
||||
Patch6000: 2.36-login-lastlog-create.patch
|
||||
Patch6001: backport-CVE-2021-3995.patch
|
||||
Patch6002: backport-CVE-2021-3996.patch
|
||||
Patch6003: backport-su-bash-completion-offer-usernames-rather-than-files.patch
|
||||
Patch6004: backport-Fix-memory-leaks-in-the-chcpu.patch
|
||||
Patch6005: backport-logger-fix-prio-prefix-doesn-t-use-priority-default.patch
|
||||
Patch6006: backport-vipw-flush-stdout-before-getting-answer.patch
|
||||
Patch6007: backport-login-Restore-tty-size-after-calling-vhangup.patch
|
||||
Patch6008: backport-Forward-value-of-sector_size-instead-of-its-address.patch
|
||||
Patch6009: backport-libfdisk-dereference-of-possibly-NULL-gcc-analyzer.patch
|
||||
Patch6010: backport-libfdisk-check-calloc-return-gcc-analyzer.patch
|
||||
Patch6011: backport-mcookie-fix-infinite-loop-when-use-f.patch
|
||||
Patch6012: backport-sfdisk-write-empty-label-also-when-only-ignored-part.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
|
||||
|
||||
Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch
|
||||
Patch9001: SKIPPED-no-root-permissions-test.patch
|
||||
@ -52,7 +57,6 @@ Provides: /bin/dmesg /bin/kill /bin/more /bin/mount /bin/umount /sbin/blki
|
||||
Provides: /sbin/blockdev /sbin/findfs /sbin/fsck /sbin/nologin
|
||||
Obsoletes: eject <= 2.1.5 rfkill <= 0.5 util-linux-ng < 2.19 hardlink <= 1:1.3-9
|
||||
|
||||
|
||||
%description
|
||||
The util-linux package contains a random collection of files that
|
||||
implements some low-level basic linux utilities.
|
||||
@ -329,7 +333,7 @@ fi
|
||||
%{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}
|
||||
%{compldir}/{fdformat,hwclock,cfdisk,sfdisk,scriptlive,irqtop,lsirq}
|
||||
%{compldir}/{fdformat,hwclock,cfdisk,sfdisk,scriptlive,irqtop,lsirq,hardlink,uclampset}
|
||||
|
||||
%files -n libfdisk
|
||||
%license Documentation/licenses/COPYING.LGPL-2.1* libfdisk/COPYING
|
||||
@ -379,7 +383,6 @@ fi
|
||||
|
||||
%files help
|
||||
%exclude %{_datadir}/doc/util-linux/getopt/*
|
||||
%{_datadir}/bash-completion/completions/*
|
||||
%{_docdir}/%{name}/getopt-example.*
|
||||
%doc README NEWS Documentation/deprecated.txt
|
||||
%doc %attr(0644,-,-) misc-utils/getopt-*.{bash,tcsh}
|
||||
@ -401,13 +404,39 @@ fi
|
||||
%{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*}
|
||||
|
||||
%changelog
|
||||
* Thu Jun 30 2022 shangyibin<shangyibin1@h-partners.com> - 2.37.2-4
|
||||
* Sat Jul 30 2022 zhangyao<zhangyao108@hhuawei.com> - 2.37.2-8
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:Sync community patches
|
||||
|
||||
* Tue Feb 15 2022 shangyibin<shangyibin1@h-partners.com> - 2.37.2-3
|
||||
* 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
|
||||
@ -467,7 +496,7 @@ fi
|
||||
- SUG:NA
|
||||
- DESC:Add check to resolve uname26-version test failed
|
||||
|
||||
* Sun Nov 28 2020 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 2.36-2
|
||||
* Sat Nov 28 2020 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 2.36-2
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user