import util-linux-2.32.1-32.el8
This commit is contained in:
parent
101279d4b3
commit
aa1ef11ab3
@ -0,0 +1,49 @@
|
||||
From 84009d2236c73efe7dc4b74372734d5b3306670b Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Wed, 5 Sep 2018 11:51:22 +0200
|
||||
Subject: [PATCH 64/72] script: be sensitive to another SIGCHLD ssi_codes
|
||||
|
||||
The current signalfd handler cares on CLD_EXITED only. It's pretty
|
||||
insufficient as there is more situations (and codes) when child no
|
||||
more running.
|
||||
|
||||
Addresses: https://github.com/karelzak/util-linux/issues/686
|
||||
Upstream: http://github.com/util-linux/util-linux/commit/27afe5016842c22d256ea9f88b598d637ca0df84
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
term-utils/script.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/term-utils/script.c b/term-utils/script.c
|
||||
index d5ffa27f1..ff5f808de 100644
|
||||
--- a/term-utils/script.c
|
||||
+++ b/term-utils/script.c
|
||||
@@ -402,10 +402,15 @@ static void handle_signal(struct script_control *ctl, int fd)
|
||||
|
||||
switch (info.ssi_signo) {
|
||||
case SIGCHLD:
|
||||
- DBG(SIGNAL, ul_debug(" get signal SIGCHLD"));
|
||||
- if (info.ssi_code == CLD_EXITED) {
|
||||
+ DBG(SIGNAL, ul_debug(" get signal SIGCHLD [ssi_code=%d, ssi_status=%d]",
|
||||
+ info.ssi_code, info.ssi_status));
|
||||
+ if (info.ssi_code == CLD_EXITED
|
||||
+ || info.ssi_code == CLD_KILLED
|
||||
+ || info.ssi_code == CLD_DUMPED) {
|
||||
wait_for_child(ctl, 0);
|
||||
ctl->poll_timeout = 10;
|
||||
+
|
||||
+ /* In case of ssi_code is CLD_TRAPPED, CLD_STOPPED, or CLD_CONTINUED */
|
||||
} else if (info.ssi_status == SIGSTOP && ctl->child) {
|
||||
DBG(SIGNAL, ul_debug(" child stop by SIGSTOP -- stop parent too"));
|
||||
kill(getpid(), SIGSTOP);
|
||||
@@ -433,6 +438,7 @@ static void handle_signal(struct script_control *ctl, int fd)
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
+ DBG(SIGNAL, ul_debug("signal handle on FD %d done", fd));
|
||||
}
|
||||
|
||||
static void do_io(struct script_control *ctl)
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,60 @@
|
||||
From be29de8b5dfe15972455d25e15068dc31d4376ac Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Wed, 6 May 2020 13:32:46 +0200
|
||||
Subject: [PATCH 65/72] libfdisk: fix partition calculation for BLKPG_* ioctls
|
||||
|
||||
The include/partx.h interface we use in util-linux uses 512-byte
|
||||
sectors, but libfdisk uses real sector sizes.
|
||||
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2016229
|
||||
Upstream: http://github.com/util-linux/util-linux/commit/6a4d53ce6466fc97c0ee13846cd1bf7bdd7bfef0
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
libfdisk/src/context.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c
|
||||
index 779a9a889..fe7eb9e7e 100644
|
||||
--- a/libfdisk/src/context.c
|
||||
+++ b/libfdisk/src/context.c
|
||||
@@ -813,6 +813,7 @@ int fdisk_reread_changes(struct fdisk_context *cxt, struct fdisk_table *org)
|
||||
struct fdisk_partition **rem = NULL, **add = NULL, **upd = NULL;
|
||||
int change, rc = 0, err = 0;
|
||||
size_t nparts, i, nadds = 0, nupds = 0, nrems = 0;
|
||||
+ unsigned int ssf;
|
||||
|
||||
DBG(CXT, ul_debugobj(cxt, "rereading changes"));
|
||||
|
||||
@@ -845,6 +846,9 @@ int fdisk_reread_changes(struct fdisk_context *cxt, struct fdisk_table *org)
|
||||
goto done;
|
||||
}
|
||||
|
||||
+ /* sector size factor -- used to recount from real to 512-byte sectors */
|
||||
+ ssf = cxt->sector_size / 512;
|
||||
+
|
||||
for (i = 0; i < nrems; i++) {
|
||||
pa = rem[i];
|
||||
DBG(PART, ul_debugobj(pa, "#%zu calling BLKPG_DEL_PARTITION", pa->partno));
|
||||
@@ -856,7 +860,8 @@ int fdisk_reread_changes(struct fdisk_context *cxt, struct fdisk_table *org)
|
||||
for (i = 0; i < nupds; i++) {
|
||||
pa = upd[i];
|
||||
DBG(PART, ul_debugobj(pa, "#%zu calling BLKPG_RESIZE_PARTITION", pa->partno));
|
||||
- if (partx_resize_partition(cxt->dev_fd, pa->partno + 1, pa->start, pa->size) != 0) {
|
||||
+ if (partx_resize_partition(cxt->dev_fd, pa->partno + 1,
|
||||
+ pa->start * ssf, pa->size * ssf) != 0) {
|
||||
fdisk_warn(cxt, _("Failed to update system information about partition %zu"), pa->partno + 1);
|
||||
err++;
|
||||
}
|
||||
@@ -864,7 +869,8 @@ int fdisk_reread_changes(struct fdisk_context *cxt, struct fdisk_table *org)
|
||||
for (i = 0; i < nadds; i++) {
|
||||
pa = add[i];
|
||||
DBG(PART, ul_debugobj(pa, "#%zu calling BLKPG_ADD_PARTITION", pa->partno));
|
||||
- if (partx_add_partition(cxt->dev_fd, pa->partno + 1, pa->start, pa->size) != 0) {
|
||||
+ if (partx_add_partition(cxt->dev_fd, pa->partno + 1,
|
||||
+ pa->start * ssf, pa->size * ssf) != 0) {
|
||||
fdisk_warn(cxt, _("Failed to add partition %zu to system"), pa->partno + 1);
|
||||
err++;
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,48 @@
|
||||
From aecaffc55dd763c34f61937b2047f0aaaeb4e6fc Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Thu, 6 Aug 2020 11:32:33 +0200
|
||||
Subject: [PATCH 66/74] libfdisk: fix fdisk_reread_changes() for extended
|
||||
partitions
|
||||
|
||||
Linux kernel assumes only 1KiB extended partition to avoid overlapping
|
||||
with nested logical partitions. We need to follow this rule for
|
||||
BLKPG_ADD_PARTITION.
|
||||
|
||||
Addresses: https://github.com/karelzak/util-linux/issues/1112
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2041498
|
||||
Upstream: http://github.com/util-linux/util-linux/commit/33f50706fd7c1c5e53f8f355f12b685c6935f5a4
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
libfdisk/src/context.c | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c
|
||||
index fe7eb9e7e..114101980 100644
|
||||
--- a/libfdisk/src/context.c
|
||||
+++ b/libfdisk/src/context.c
|
||||
@@ -867,10 +867,21 @@ int fdisk_reread_changes(struct fdisk_context *cxt, struct fdisk_table *org)
|
||||
}
|
||||
}
|
||||
for (i = 0; i < nadds; i++) {
|
||||
+ uint64_t sz;
|
||||
+
|
||||
pa = add[i];
|
||||
+ sz = pa->size * ssf;
|
||||
+
|
||||
DBG(PART, ul_debugobj(pa, "#%zu calling BLKPG_ADD_PARTITION", pa->partno));
|
||||
+
|
||||
+ if (fdisk_is_label(cxt, DOS) && fdisk_partition_is_container(pa))
|
||||
+ /* Let's follow the Linux kernel and reduce
|
||||
+ * DOS extended partition to 1 or 2 sectors.
|
||||
+ */
|
||||
+ sz = min(sz, (uint64_t) 2);
|
||||
+
|
||||
if (partx_add_partition(cxt->dev_fd, pa->partno + 1,
|
||||
- pa->start * ssf, pa->size * ssf) != 0) {
|
||||
+ pa->start * ssf, sz) != 0) {
|
||||
fdisk_warn(cxt, _("Failed to add partition %zu to system"), pa->partno + 1);
|
||||
err++;
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
76
SOURCES/0067-logger-fix-size-use-for-stdin.patch
Normal file
76
SOURCES/0067-logger-fix-size-use-for-stdin.patch
Normal file
@ -0,0 +1,76 @@
|
||||
From 7cc5bcfcb2340266a6b42370c9c4c02d8a325d5f Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Thu, 21 Oct 2021 18:47:40 +0200
|
||||
Subject: [PATCH 67/74] 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
|
||||
Upstream: http://github.com/util-linux/util-linux/commit/58e4ee082bca100034791a4a74481f263bb30a25
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
misc-utils/logger.c | 16 ++++------------
|
||||
1 file changed, 4 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/misc-utils/logger.c b/misc-utils/logger.c
|
||||
index ebdc56ec2..c20ef05f1 100644
|
||||
--- a/misc-utils/logger.c
|
||||
+++ b/misc-utils/logger.c
|
||||
@@ -957,11 +957,9 @@ 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);
|
||||
+ char *buf = xmalloc(ctl->max_message_size + 2 + 2);
|
||||
int pri;
|
||||
int c;
|
||||
size_t i;
|
||||
@@ -988,27 +986,21 @@ 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);
|
||||
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();
|
||||
}
|
||||
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();
|
||||
--
|
||||
2.31.1
|
||||
|
32
SOURCES/0068-fstrim-improve-timer-setting.patch
Normal file
32
SOURCES/0068-fstrim-improve-timer-setting.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From ebb628f8b6e9564c036fce152f67512e5755dcfc Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Mon, 6 Dec 2021 13:20:37 +0100
|
||||
Subject: [PATCH 68/74] fstrim: improve timer setting
|
||||
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1916151
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
sys-utils/fstrim.timer | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/sys-utils/fstrim.timer b/sys-utils/fstrim.timer
|
||||
index 3a3762d5c..54b3c18f5 100644
|
||||
--- a/sys-utils/fstrim.timer
|
||||
+++ b/sys-utils/fstrim.timer
|
||||
@@ -1,11 +1,13 @@
|
||||
[Unit]
|
||||
Description=Discard unused blocks once a week
|
||||
Documentation=man:fstrim
|
||||
+ConditionVirtualization=!container
|
||||
|
||||
[Timer]
|
||||
OnCalendar=weekly
|
||||
AccuracySec=1h
|
||||
Persistent=true
|
||||
+RandomizedDelaySec=6000
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,185 @@
|
||||
From 0b421290e05862e1abbb5a82654bd2de9829dd58 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Tue, 10 Apr 2018 12:08:21 +0100
|
||||
Subject: [PATCH 69/74] setpriv: implement option to set parent death signal
|
||||
|
||||
When a process uses the syscall `prctl(PR_SET_PDEATHSIG, ...)`, it will
|
||||
get notified with a process-defined signal as soon as its parent process
|
||||
dies. This is for example being used by unshare(1)'s recently added
|
||||
"--kill-child" option, causing the forked child to be killed as soon as
|
||||
unshare itself dies.
|
||||
|
||||
Unfortunately, some LSMs will cause the parent death signal to be reset
|
||||
when a process changes credentials, with the most important ones being
|
||||
SELinux and AppArmor. The following command will thus not work as
|
||||
expected:
|
||||
|
||||
unshare --fork --kill-child setpriv --reuid user <executable>
|
||||
|
||||
As soon as setpriv changes UID, the parent death signal is cleared and
|
||||
the child will never get signalled when unshare gets killed.
|
||||
|
||||
Add a new option "--pdeathsig keep|clear|<signal>". Setting this flag
|
||||
will cause us to either
|
||||
|
||||
- restore the previously active parent death signal as soon as the
|
||||
setpriv has applied all credential changes
|
||||
- clear the parent death signal
|
||||
- set the parent death signal to "<signal>"
|
||||
|
||||
Furthermore, print out the currently set signal when dumping process
|
||||
state.
|
||||
|
||||
[kzak@redhat.com: - small changes in codding style]
|
||||
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1894192
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
sys-utils/setpriv.1 | 6 ++++++
|
||||
sys-utils/setpriv.c | 49 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 55 insertions(+)
|
||||
|
||||
diff --git a/sys-utils/setpriv.1 b/sys-utils/setpriv.1
|
||||
index b900f6e08..f989bf33c 100644
|
||||
--- a/sys-utils/setpriv.1
|
||||
+++ b/sys-utils/setpriv.1
|
||||
@@ -139,6 +139,12 @@ is cleared by
|
||||
.BR execve (2)
|
||||
and is therefore not allowed.
|
||||
.TP
|
||||
+.BR "\-\-pdeathsig keep" | clear | <signal>
|
||||
+Keep, clear or set the parent death signal. Some LSMs, most notably SELinux and
|
||||
+AppArmor, clear the signal when the process' credentials change. Using
|
||||
+\fB--pdeathsig keep\fR will restore the parent death signal after changing
|
||||
+credentials to remedy that situation.
|
||||
+.TP
|
||||
.BI \-\-selinux\-label " label"
|
||||
Request a particular SELinux transition (using a transition on exec, not
|
||||
dyntrans). This will fail and cause
|
||||
diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c
|
||||
index 4147978cc..0d3a3b3c9 100644
|
||||
--- a/sys-utils/setpriv.c
|
||||
+++ b/sys-utils/setpriv.c
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "strutils.h"
|
||||
#include "xalloc.h"
|
||||
#include "pathnames.h"
|
||||
+#include "signames.h"
|
||||
|
||||
#ifndef PR_SET_NO_NEW_PRIVS
|
||||
# define PR_SET_NO_NEW_PRIVS 38
|
||||
@@ -102,6 +103,8 @@ struct privctx {
|
||||
|
||||
/* securebits */
|
||||
int securebits;
|
||||
+ /* parent death signal (<0 clear, 0 nothing, >0 signal) */
|
||||
+ int pdeathsig;
|
||||
|
||||
/* LSMs */
|
||||
const char *selinux_label;
|
||||
@@ -135,6 +138,8 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||
fputs(_(" --init-groups initialize supplementary groups\n"), out);
|
||||
fputs(_(" --groups <group,...> set supplementary groups\n"), out);
|
||||
fputs(_(" --securebits <bits> set securebits\n"), out);
|
||||
+ fputs(_(" --pdeathsig keep|clear|<signame>\n"
|
||||
+ " set or clear parent death signal\n"), out);
|
||||
fputs(_(" --selinux-label <label> set SELinux label\n"), out);
|
||||
fputs(_(" --apparmor-profile <pr> set AppArmor profile\n"), out);
|
||||
|
||||
@@ -329,6 +334,24 @@ static void dump_groups(void)
|
||||
free(groups);
|
||||
}
|
||||
|
||||
+static void dump_pdeathsig(void)
|
||||
+{
|
||||
+ int pdeathsig;
|
||||
+
|
||||
+ if (prctl(PR_GET_PDEATHSIG, &pdeathsig) != 0) {
|
||||
+ warn(_("get pdeathsig failed"));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ printf("Parent death signal: ");
|
||||
+ if (pdeathsig && signum_to_signame(pdeathsig) != NULL)
|
||||
+ printf("%s\n", signum_to_signame(pdeathsig));
|
||||
+ else if (pdeathsig)
|
||||
+ printf("%d\n", pdeathsig);
|
||||
+ else
|
||||
+ printf("[none]\n");
|
||||
+}
|
||||
+
|
||||
static void dump(int dumplevel)
|
||||
{
|
||||
int x;
|
||||
@@ -392,6 +415,7 @@ static void dump(int dumplevel)
|
||||
printf("\n");
|
||||
|
||||
dump_securebits();
|
||||
+ dump_pdeathsig();
|
||||
|
||||
if (access(_PATH_SYS_SELINUX, F_OK) == 0)
|
||||
dump_label(_("SELinux label"));
|
||||
@@ -438,6 +462,19 @@ static void parse_groups(struct privctx *opts, const char *str)
|
||||
free(groups);
|
||||
}
|
||||
|
||||
+static void parse_pdeathsig(struct privctx *opts, const char *str)
|
||||
+{
|
||||
+ if (!strcmp(str, "keep")) {
|
||||
+ if (prctl(PR_GET_PDEATHSIG, &opts->pdeathsig) != 0)
|
||||
+ errx(SETPRIV_EXIT_PRIVERR,
|
||||
+ _("failed to get parent death signal"));
|
||||
+ } else if (!strcmp(str, "clear")) {
|
||||
+ opts->pdeathsig = -1;
|
||||
+ } else if ((opts->pdeathsig = signame_to_signum(str)) < 0) {
|
||||
+ errx(EXIT_FAILURE, _("unknown signal: %s"), str);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void do_setresuid(const struct privctx *opts)
|
||||
{
|
||||
uid_t ruid, euid, suid;
|
||||
@@ -711,6 +748,7 @@ int main(int argc, char **argv)
|
||||
LISTCAPS,
|
||||
CAPBSET,
|
||||
SECUREBITS,
|
||||
+ PDEATHSIG,
|
||||
SELINUX_LABEL,
|
||||
APPARMOR_PROFILE
|
||||
};
|
||||
@@ -734,6 +772,7 @@ int main(int argc, char **argv)
|
||||
{ "groups", required_argument, NULL, GROUPS },
|
||||
{ "bounding-set", required_argument, NULL, CAPBSET },
|
||||
{ "securebits", required_argument, NULL, SECUREBITS },
|
||||
+ { "pdeathsig", required_argument, NULL, PDEATHSIG, },
|
||||
{ "selinux-label", required_argument, NULL, SELINUX_LABEL },
|
||||
{ "apparmor-profile", required_argument, NULL, APPARMOR_PROFILE },
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
@@ -844,6 +883,12 @@ int main(int argc, char **argv)
|
||||
_("duplicate --groups option"));
|
||||
parse_groups(&opts, optarg);
|
||||
break;
|
||||
+ case PDEATHSIG:
|
||||
+ if (opts.pdeathsig)
|
||||
+ errx(EXIT_FAILURE,
|
||||
+ _("duplicate --keep-pdeathsig option"));
|
||||
+ parse_pdeathsig(&opts, optarg);
|
||||
+ break;
|
||||
case LISTCAPS:
|
||||
list_caps = 1;
|
||||
break;
|
||||
@@ -989,6 +1034,10 @@ int main(int argc, char **argv)
|
||||
do_caps(CAP_TYPE_AMBIENT, opts.ambient_caps);
|
||||
}
|
||||
|
||||
+ /* Clear or set parent death signal */
|
||||
+ if (opts.pdeathsig && prctl(PR_SET_PDEATHSIG, opts.pdeathsig < 0 ? 0 : opts.pdeathsig) != 0)
|
||||
+ err(SETPRIV_EXIT_PRIVERR, _("set parent death signal failed"));
|
||||
+
|
||||
execvp(argv[optind], argv + optind);
|
||||
errexec(argv[optind]);
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
86
SOURCES/0070-lib-sys-add-sysfs_chrdev_devno_to_devname.patch
Normal file
86
SOURCES/0070-lib-sys-add-sysfs_chrdev_devno_to_devname.patch
Normal file
@ -0,0 +1,86 @@
|
||||
From 0db1f9965e6791c651d0bccd095cbe3a87c6579c Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Thu, 25 Nov 2021 11:52:46 +0100
|
||||
Subject: [PATCH 70/74] lib/sys: add sysfs_chrdev_devno_to_devname()
|
||||
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2026511
|
||||
Upstream: http://github.com/util-linux/util-linux/commit/ab5304a7a34bfa45d9bee205ca4e26f03db6e79d
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
include/pathnames.h | 1 +
|
||||
include/sysfs.h | 2 ++
|
||||
lib/sysfs.c | 33 +++++++++++++++++++++++++++++++++
|
||||
3 files changed, 36 insertions(+)
|
||||
|
||||
diff --git a/include/pathnames.h b/include/pathnames.h
|
||||
index 59cc66736..77f8b6e85 100644
|
||||
--- a/include/pathnames.h
|
||||
+++ b/include/pathnames.h
|
||||
@@ -102,6 +102,7 @@
|
||||
|
||||
#define _PATH_SYS_BLOCK "/sys/block"
|
||||
#define _PATH_SYS_DEVBLOCK "/sys/dev/block"
|
||||
+#define _PATH_SYS_DEVCHAR "/sys/dev/char"
|
||||
#define _PATH_SYS_CLASS "/sys/class"
|
||||
#define _PATH_SYS_SCSI "/sys/bus/scsi"
|
||||
|
||||
diff --git a/include/sysfs.h b/include/sysfs.h
|
||||
index 9a72a2009..e2fd0c1ba 100644
|
||||
--- a/include/sysfs.h
|
||||
+++ b/include/sysfs.h
|
||||
@@ -92,6 +92,8 @@ extern int sysfs_scsi_host_is(struct sysfs_cxt *cxt, const char *type);
|
||||
extern int sysfs_scsi_has_attribute(struct sysfs_cxt *cxt, const char *attr);
|
||||
extern int sysfs_scsi_path_contains(struct sysfs_cxt *cxt, const char *pattern);
|
||||
|
||||
+extern char *sysfs_chrdev_devno_to_devname(dev_t devno, char *buf, size_t bufsiz);
|
||||
+
|
||||
/**
|
||||
* sysfs_devname_sys_to_dev:
|
||||
* @name: devname to be converted in place
|
||||
diff --git a/lib/sysfs.c b/lib/sysfs.c
|
||||
index e5437f43a..ceec41d10 100644
|
||||
--- a/lib/sysfs.c
|
||||
+++ b/lib/sysfs.c
|
||||
@@ -1036,6 +1036,39 @@ int sysfs_scsi_path_contains(struct sysfs_cxt *cxt, const char *pattern)
|
||||
return strstr(linkc, pattern) != NULL;
|
||||
}
|
||||
|
||||
+char *sysfs_chrdev_devno_to_devname(dev_t devno, char *buf, size_t bufsiz)
|
||||
+{
|
||||
+ char link[PATH_MAX];
|
||||
+ char path[PATH_MAX];
|
||||
+ char *name;
|
||||
+ ssize_t sz;
|
||||
+
|
||||
+ sz = snprintf(path, sizeof(path),
|
||||
+ _PATH_SYS_DEVCHAR "/%u:%u", major(devno), minor(devno));
|
||||
+ if (sz <= 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ /* read /sys/dev/char/<maj:min> link */
|
||||
+ sz = readlink(path, link, sizeof(link) - 1);
|
||||
+ if (sz < 0)
|
||||
+ return NULL;
|
||||
+ link[sz] = '\0';
|
||||
+
|
||||
+ name = strrchr(link, '/');
|
||||
+ if (!name)
|
||||
+ return NULL;
|
||||
+
|
||||
+ name++;
|
||||
+ sz = strlen(name);
|
||||
+ if ((size_t) sz + 1 > bufsiz)
|
||||
+ return NULL;
|
||||
+
|
||||
+ memcpy(buf, name, sz + 1);
|
||||
+ sysfs_devname_sys_to_dev(buf);
|
||||
+ return buf;
|
||||
+
|
||||
+}
|
||||
+
|
||||
#ifdef TEST_PROGRAM_SYSFS
|
||||
#include <errno.h>
|
||||
#include <err.h>
|
||||
--
|
||||
2.31.1
|
||||
|
39
SOURCES/0071-libblkid-check-UBI-char-device-name.patch
Normal file
39
SOURCES/0071-libblkid-check-UBI-char-device-name.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From 7ce318610afcbb793e438332687c2f09844a86c2 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Thu, 25 Nov 2021 11:54:11 +0100
|
||||
Subject: [PATCH 71/74] libblkid: check UBI char device name
|
||||
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2026511
|
||||
Upstream: http://github.com/util-linux/util-linux/commit/7eb6d9ce4526b968e30f7e538cbbbdf9938e5891
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
libblkid/src/probe.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
|
||||
index a6dc8416a..49a62c47f 100644
|
||||
--- a/libblkid/src/probe.c
|
||||
+++ b/libblkid/src/probe.c
|
||||
@@ -915,9 +915,17 @@ int blkid_probe_set_device(blkid_probe pr, int fd,
|
||||
DBG(LOWPROBE, ul_debug("failed to get device size"));
|
||||
goto err;
|
||||
}
|
||||
- } else if (S_ISCHR(sb.st_mode))
|
||||
+ } else if (S_ISCHR(sb.st_mode)) {
|
||||
+ char buf[PATH_MAX];
|
||||
+
|
||||
+ if (!sysfs_chrdev_devno_to_devname(sb.st_rdev, buf, sizeof(buf))
|
||||
+ || strncmp(buf, "ubi", 3) != 0) {
|
||||
+ DBG(LOWPROBE, ul_debug("no UBI char device"));
|
||||
+ errno = EINVAL;
|
||||
+ goto err;
|
||||
+ }
|
||||
devsiz = 1; /* UBI devices are char... */
|
||||
- else if (S_ISREG(sb.st_mode))
|
||||
+ } else if (S_ISREG(sb.st_mode))
|
||||
devsiz = sb.st_size; /* regular file */
|
||||
|
||||
pr->size = size ? (uint64_t)size : devsiz;
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,63 @@
|
||||
From 90783d6294351229efdee5469dd8cd08d0057731 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Thu, 25 Nov 2021 11:54:26 +0100
|
||||
Subject: [PATCH 72/74] blkid: check device type and name before probe
|
||||
|
||||
For calls "blkid /dev/*", it seems better to check the
|
||||
device type and name before we open the device in libblkid.
|
||||
|
||||
Upstream: http://github.com/util-linux/util-linux/commit/64cfe6ac37631a6347bd4005c72dd2d37e737f5e
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2026511
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
misc-utils/blkid.c | 27 +++++++++++++++++++++++++--
|
||||
1 file changed, 25 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c
|
||||
index 61a6994c2..bd4ce4a39 100644
|
||||
--- a/misc-utils/blkid.c
|
||||
+++ b/misc-utils/blkid.c
|
||||
@@ -46,6 +46,8 @@
|
||||
#define XALLOC_EXIT_CODE BLKID_EXIT_OTHER /* x.*alloc(), xstrndup() */
|
||||
#include "xalloc.h"
|
||||
|
||||
+#include "sysfs.h"
|
||||
+
|
||||
struct blkid_control {
|
||||
int output;
|
||||
uintmax_t offset;
|
||||
@@ -813,8 +815,29 @@ int main(int argc, char **argv)
|
||||
/* The rest of the args are device names */
|
||||
if (optind < argc) {
|
||||
devices = xcalloc(argc - optind, sizeof(char *));
|
||||
- while (optind < argc)
|
||||
- devices[numdev++] = argv[optind++];
|
||||
+ while (optind < argc) {
|
||||
+ char *dev = argv[optind++];
|
||||
+ struct stat sb;
|
||||
+
|
||||
+ if (stat(dev, &sb) != 0)
|
||||
+ continue;
|
||||
+ else if (S_ISBLK(sb.st_mode))
|
||||
+ ;
|
||||
+ else if (S_ISREG(sb.st_mode))
|
||||
+ ;
|
||||
+ else if (S_ISCHR(sb.st_mode)) {
|
||||
+ char buf[PATH_MAX];
|
||||
+
|
||||
+ if (!sysfs_chrdev_devno_to_devname(
|
||||
+ sb.st_rdev, buf, sizeof(buf)))
|
||||
+ continue;
|
||||
+ if (strncmp(buf, "ubi", 3) != 0)
|
||||
+ continue;
|
||||
+ } else
|
||||
+ continue;
|
||||
+
|
||||
+ devices[numdev++] = dev;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* convert LABEL/UUID lookup to evaluate request */
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,40 @@
|
||||
From aa57abc10273f250a7ab6525bd45dc2bdc5e4b41 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Mon, 10 Jan 2022 16:32:44 +0100
|
||||
Subject: [PATCH 73/74] blkid: don't print all devices if only garbage
|
||||
specified
|
||||
|
||||
There is small regression. The old version (before
|
||||
64cfe6ac37631a6347bd4005c72dd2d37e737f5e) returns nothing when
|
||||
|
||||
# blkid /dontexist
|
||||
|
||||
specified on command line.
|
||||
|
||||
Upstream: http://github.com/util-linux/util-linux/commit/9e882685a3db3fd5e0870e7b94a4ea25ddc199c7
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2026511
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
misc-utils/blkid.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c
|
||||
index bd4ce4a39..bc0d3465d 100644
|
||||
--- a/misc-utils/blkid.c
|
||||
+++ b/misc-utils/blkid.c
|
||||
@@ -838,6 +838,12 @@ int main(int argc, char **argv)
|
||||
|
||||
devices[numdev++] = dev;
|
||||
}
|
||||
+
|
||||
+ if (!numdev) {
|
||||
+ /* only unsupported devices specified */
|
||||
+ err = BLKID_EXIT_NOTFOUND;
|
||||
+ goto exit;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* convert LABEL/UUID lookup to evaluate request */
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,54 @@
|
||||
From 9e7cedda86e5356d1723e6bd0bab5e38c4fe4a34 Mon Sep 17 00:00:00 2001
|
||||
From: "Andrew G. Morgan" <morgan@kernel.org>
|
||||
Date: Sat, 27 Nov 2021 21:00:22 -0800
|
||||
Subject: [PATCH 74/74] Complete Linux-PAM compliance for forked child in su
|
||||
and login.
|
||||
|
||||
As documented here:
|
||||
|
||||
http://www.linux-pam.org/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_end
|
||||
|
||||
The child that is about to exec*() the user shell is supposed to pam_end()
|
||||
with PAM_DATA_SILENT. This gives the modules a last chance to do a minor
|
||||
cleanup of the module state before the user's shell is launched.
|
||||
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1950187
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2033566
|
||||
Upstream: http://github.com/util-linux/util-linux/commit/4660286e9cdff6d95b49295674b96f83af10ea36
|
||||
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
|
||||
---
|
||||
login-utils/login.c | 3 +++
|
||||
login-utils/su-common.c | 3 +++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/login-utils/login.c b/login-utils/login.c
|
||||
index 8c9e43292..9f50fe03b 100644
|
||||
--- a/login-utils/login.c
|
||||
+++ b/login-utils/login.c
|
||||
@@ -1370,6 +1370,9 @@ int main(int argc, char **argv)
|
||||
|
||||
childArgv[childArgc++] = NULL;
|
||||
|
||||
+ /* http://www.linux-pam.org/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_end */
|
||||
+ (void) pam_end(cxt.pamh, PAM_SUCCESS|PAM_DATA_SILENT);
|
||||
+
|
||||
execvp(childArgv[0], childArgv + 1);
|
||||
|
||||
if (!strcmp(childArgv[0], "/bin/sh"))
|
||||
diff --git a/login-utils/su-common.c b/login-utils/su-common.c
|
||||
index c1b1a04e4..825ff1d5a 100644
|
||||
--- a/login-utils/su-common.c
|
||||
+++ b/login-utils/su-common.c
|
||||
@@ -1428,6 +1428,9 @@ int su_main(int argc, char **argv, int mode)
|
||||
if (su->simulate_login && chdir(su->pwd->pw_dir) != 0)
|
||||
warn(_("warning: cannot change directory to %s"), su->pwd->pw_dir);
|
||||
|
||||
+ /* http://www.linux-pam.org/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_end */
|
||||
+ (void) pam_end(su->pamh, PAM_SUCCESS|PAM_DATA_SILENT);
|
||||
+
|
||||
if (shell)
|
||||
run_shell(su, shell, command, argv + optind, max(0, argc - optind));
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
@ -2,7 +2,7 @@
|
||||
Summary: A collection of basic system utilities
|
||||
Name: util-linux
|
||||
Version: 2.32.1
|
||||
Release: 28%{?dist}
|
||||
Release: 32%{?dist}
|
||||
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
|
||||
Group: System Environment/Base
|
||||
URL: http://en.wikipedia.org/wiki/Util-linux
|
||||
@ -221,6 +221,27 @@ Patch62: 0062-libmount-accept-another-flags-on-MS_REMOUNT-MS_BIND.patch
|
||||
# 1946921 - RHEL8: mount --rbind -o rprivate doesn't do recursive bind mount
|
||||
Patch63: 0063-libmount-improve-MS_REC-usage.patch
|
||||
|
||||
### RHEL-8.6
|
||||
###
|
||||
# 1988955 - script command continues without stopping.
|
||||
Patch64: 0064-script-be-sensitive-to-another-SIGCHLD-ssi_codes.patch
|
||||
# 2041498 - incorrect partition size calculation for BLKPG_* ioctls
|
||||
Patch65: 0065-libfdisk-fix-partition-calculation-for-BLKPG_-ioctls.patch
|
||||
Patch66: 0066-libfdisk-fix-fdisk_reread_changes-for-extended-parti.patch
|
||||
# 2011602 - logger from util-linux incorrectly handles long messages
|
||||
Patch67: 0067-logger-fix-size-use-for-stdin.patch
|
||||
# 1916151 - [RFE] spread fstrim.timer across time
|
||||
Patch68: 0068-fstrim-improve-timer-setting.patch
|
||||
# 1894192 - Update or backport setpriv --pdeathsig
|
||||
Patch69: 0069-setpriv-implement-option-to-set-parent-death-signal.patch
|
||||
# 2026511 - blkid fails to complete when targeting non-block devices
|
||||
Patch70: 0070-lib-sys-add-sysfs_chrdev_devno_to_devname.patch
|
||||
Patch71: 0071-libblkid-check-UBI-char-device-name.patch
|
||||
Patch72: 0072-blkid-check-device-type-and-name-before-probe.patch
|
||||
Patch73: 0073-blkid-don-t-print-all-devices-if-only-garbage-specif.patch
|
||||
# 1950187 - Ambient capabilities failed to applied to non-root user even when correct rules are in /etc/security/capability.conf
|
||||
Patch74: 0074-Complete-Linux-PAM-compliance-for-forked-child-in-su.patch
|
||||
|
||||
|
||||
%description
|
||||
The util-linux package contains a large variety of low-level system
|
||||
@ -1086,6 +1107,24 @@ fi
|
||||
%{_libdir}/python*/site-packages/libmount/
|
||||
|
||||
%changelog
|
||||
* Mon Jan 17 2022 Karel Zak <kzak@redhat.com> 2.32.1-32
|
||||
- change bug number (#2016229 to #2041498)
|
||||
|
||||
* Tue Jan 11 2022 Karel Zak <kzak@redhat.com> 2.32.1-31
|
||||
- improve #2026511 fix - blkid fails to complete when targeting non-block devices
|
||||
- fix #1950187 - Ambient capabilities failed to applied to non-root user
|
||||
|
||||
* Mon Jan 03 2022 Karel Zak <kzak@redhat.com> 2.32.1-30
|
||||
- update lib-sys-add-sysfs_chrdev_devno_to_devname.patch (#2026511)
|
||||
|
||||
* Tue Dec 07 2021 Karel Zak <kzak@redhat.com> 2.32.1-29
|
||||
- fix #1988955 - script command continues without stopping.
|
||||
- fix #2041498 - incorrect partition size calculation for BLKPG_* ioctls
|
||||
- fix #2011602 - logger from util-linux incorrectly handles long messages
|
||||
- fix #1916151 - [RFE] spread fstrim.timer across time
|
||||
- fix #1894192 - Update or backport setpriv --pdeathsig
|
||||
- fix #2026511 - blkid fails to complete when targeting non-block devices
|
||||
|
||||
* Mon Jun 07 2021 Karel Zak <kzak@redhat.com> 2.32.1-28
|
||||
- fix #1906157 - after su from root to a normal user mesg is unable to show current status
|
||||
- fix #1917852 - findmnt: add option to list all fs-independent flags
|
||||
|
Loading…
Reference in New Issue
Block a user