Toshaan Bharvani
3 years ago
commit
ff48edbc31
20 changed files with 3726 additions and 0 deletions
@ -0,0 +1,26 @@ |
|||||||
|
From ef8c8e117234f135a22ba7180114f0153b2444d8 Mon Sep 17 00:00:00 2001 |
||||||
|
From: Karel Zak <kzak@redhat.com> |
||||||
|
Date: Mon, 20 Jun 2016 11:09:02 +0200 |
||||||
|
Subject: login: create /var/log/lastlog |
||||||
|
|
||||||
|
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=151635 |
||||||
|
--- |
||||||
|
login-utils/login.c | 2 +- |
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-) |
||||||
|
|
||||||
|
diff --git a/login-utils/login.c b/login-utils/login.c |
||||||
|
index c6cd340b6..3657f04cd 100644 |
||||||
|
--- a/login-utils/login.c |
||||||
|
+++ b/login-utils/login.c |
||||||
|
@@ -662,7 +662,7 @@ static void log_lastlog(struct login_context *cxt) |
||||||
|
sa.sa_handler = SIG_IGN; |
||||||
|
sigaction(SIGXFSZ, &sa, &oldsa_xfsz); |
||||||
|
|
||||||
|
- fd = open(_PATH_LASTLOG, O_RDWR, 0); |
||||||
|
+ fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0); |
||||||
|
if (fd < 0) |
||||||
|
goto done; |
||||||
|
offset = cxt->pwd->pw_uid * sizeof(ll); |
||||||
|
-- |
||||||
|
2.34.1 |
||||||
|
|
@ -0,0 +1,28 @@ |
|||||||
|
From c8574869e60a0351551cb281872e08b4d8fc68d8 Mon Sep 17 00:00:00 2001 |
||||||
|
From: Karel Zak <kzak@redhat.com> |
||||||
|
Date: Tue, 24 Aug 2021 13:50:57 +0200 |
||||||
|
Subject: login: default motd file |
||||||
|
|
||||||
|
Add `/run/motd.d` to the hardcoded MOTD_FILE |
||||||
|
|
||||||
|
Addresses: https://github.com/coreos/console-login-helper-messages/issues/60 |
||||||
|
--- |
||||||
|
include/pathnames.h | 2 +- |
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-) |
||||||
|
|
||||||
|
diff --git a/include/pathnames.h b/include/pathnames.h |
||||||
|
index 9be2baa83..7e7d9053f 100644 |
||||||
|
--- a/include/pathnames.h |
||||||
|
+++ b/include/pathnames.h |
||||||
|
@@ -41,7 +41,7 @@ |
||||||
|
#ifndef _PATH_MAILDIR |
||||||
|
# define _PATH_MAILDIR "/var/spool/mail" |
||||||
|
#endif |
||||||
|
-#define _PATH_MOTDFILE "/usr/share/misc/motd:/run/motd:/etc/motd" |
||||||
|
+#define _PATH_MOTDFILE "/usr/share/misc/motd:/run/motd:/run/motd.d:/etc/motd:/etc/motd.d" |
||||||
|
#ifndef _PATH_NOLOGIN |
||||||
|
# define _PATH_NOLOGIN "/etc/nologin" |
||||||
|
#endif |
||||||
|
-- |
||||||
|
2.34.1 |
||||||
|
|
@ -0,0 +1,30 @@ |
|||||||
|
From 38b2b2e49e72638639c997e532a846ee935ce148 Mon Sep 17 00:00:00 2001 |
||||||
|
From: Karel Zak <kzak@redhat.com> |
||||||
|
Date: Mon, 23 Aug 2021 15:15:38 +0200 |
||||||
|
Subject: tests: make ./run.sh more robust |
||||||
|
|
||||||
|
Let's make upstream tests more stable to be usable in RHEL |
||||||
|
environment where we do not use ASAN and meson. |
||||||
|
|
||||||
|
Upstream: http://github.com/karelzak/util-linux/commit/331c5e0c54d9cb6f67dc3e825eec2d78c67d8ce6 |
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com> |
||||||
|
--- |
||||||
|
tests/run.sh | 2 +- |
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-) |
||||||
|
|
||||||
|
diff --git a/tests/run.sh b/tests/run.sh |
||||||
|
index 9d26406c4..d020bfe88 100755 |
||||||
|
--- a/tests/run.sh |
||||||
|
+++ b/tests/run.sh |
||||||
|
@@ -165,7 +165,7 @@ OPTS="$OPTS --srcdir=$top_srcdir --builddir=$top_builddir" |
||||||
|
if [ -z "$has_asan_opt" ]; then |
||||||
|
if [ -e "$top_builddir/Makefile" ]; then |
||||||
|
asan=$(awk '/^ASAN_LDFLAGS/ { print $3 }' $top_builddir/Makefile) |
||||||
|
- else |
||||||
|
+ elif [ -f "$top_builddir/meson.conf" ]; then |
||||||
|
. "$top_builddir/meson.conf" |
||||||
|
fi |
||||||
|
if [ -n "$asan" ]; then |
||||||
|
-- |
||||||
|
2.34.1 |
||||||
|
|
@ -0,0 +1,66 @@ |
|||||||
|
From a4d1feed2803a5c0596877b64487734bcdb781ef Mon Sep 17 00:00:00 2001 |
||||||
|
From: Karel Zak <kzak@redhat.com> |
||||||
|
Date: Mon, 23 Aug 2021 16:28:52 +0200 |
||||||
|
Subject: tests: make mount/fstab-all more robust |
||||||
|
|
||||||
|
Upstream: http://github.com/karelzak/util-linux/commit/85ae61dd6d956e7c9fe2b22b8c46bb1d0bfd13da |
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com> |
||||||
|
--- |
||||||
|
tests/ts/mount/fstab-all | 6 ++++++ |
||||||
|
1 file changed, 6 insertions(+) |
||||||
|
|
||||||
|
diff --git a/tests/ts/mount/fstab-all b/tests/ts/mount/fstab-all |
||||||
|
index acc64e462..6b7018823 100755 |
||||||
|
--- a/tests/ts/mount/fstab-all |
||||||
|
+++ b/tests/ts/mount/fstab-all |
||||||
|
@@ -79,6 +79,7 @@ echo "${TS_DEVICE}4 ${MOUNTPOINT}D ext4 rw,defaults 0 0" >> $MY_FSTAB |
||||||
|
ts_init_subtest "basic" |
||||||
|
$TS_CMD_MOUNT --all --fstab $MY_FSTAB >> $TS_OUTPUT 2>> $TS_ERRLOG |
||||||
|
[ $? == 0 ] || ts_log "mount failed" |
||||||
|
+udevadm settle |
||||||
|
$TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D} |
||||||
|
[ $? == 0 ] || ts_log "umount failed" |
||||||
|
ts_finalize_subtest |
||||||
|
@@ -87,6 +88,7 @@ ts_finalize_subtest |
||||||
|
ts_init_subtest "filter-type" |
||||||
|
$TS_CMD_MOUNT --all --fstab $MY_FSTAB -t ext4 >> $TS_OUTPUT 2>> $TS_ERRLOG |
||||||
|
[ $? == 0 ] || ts_log "mount failed" |
||||||
|
+udevadm settle |
||||||
|
$TS_CMD_UMOUNT ${MOUNTPOINT}D |
||||||
|
[ $? == 0 ] || ts_log "umount failed" |
||||||
|
ts_finalize_subtest |
||||||
|
@@ -95,6 +97,7 @@ ts_finalize_subtest |
||||||
|
ts_init_subtest "filter-notype" |
||||||
|
$TS_CMD_MOUNT --all --fstab $MY_FSTAB -t noext4 >> $TS_OUTPUT 2>> $TS_ERRLOG |
||||||
|
[ $? == 0 ] || ts_log "mount failed" |
||||||
|
+udevadm settle |
||||||
|
$TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C} |
||||||
|
[ $? == 0 ] || ts_log "umount failed" |
||||||
|
ts_finalize_subtest |
||||||
|
@@ -103,6 +106,7 @@ ts_finalize_subtest |
||||||
|
ts_init_subtest "filter-option" |
||||||
|
$TS_CMD_MOUNT --all --fstab $MY_FSTAB -O ro >> $TS_OUTPUT 2>> $TS_ERRLOG |
||||||
|
[ $? == 0 ] || ts_log "mount failed" |
||||||
|
+udevadm settle |
||||||
|
$TS_CMD_UMOUNT ${MOUNTPOINT}C |
||||||
|
[ $? == 0 ] || ts_log "umount failed" |
||||||
|
ts_finalize_subtest |
||||||
|
@@ -111,6 +115,7 @@ ts_finalize_subtest |
||||||
|
ts_init_subtest "override-option" |
||||||
|
$TS_CMD_MOUNT --all --fstab $MY_FSTAB -o ro >> $TS_OUTPUT 2>> $TS_ERRLOG |
||||||
|
[ $? == 0 ] || ts_log "mount failed" |
||||||
|
+udevadm settle |
||||||
|
$TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D} |
||||||
|
[ $? == 0 ] || ts_log "umount failed" |
||||||
|
ts_finalize_subtest |
||||||
|
@@ -132,6 +137,7 @@ $TS_CMD_MOUNT --all \ |
||||||
|
--target-prefix $MY_ROOT \ |
||||||
|
-o X-mount.mkdir >> $TS_OUTPUT 2>> $TS_ERRLOG |
||||||
|
[ $? == 0 ] || ts_log "mount failed" |
||||||
|
+udevadm settle |
||||||
|
$TS_CMD_UMOUNT $MY_ROOT/foo/{A,B,C,D} |
||||||
|
[ $? == 0 ] || ts_log "umount failed" |
||||||
|
ts_finalize_subtest |
||||||
|
-- |
||||||
|
2.34.1 |
||||||
|
|
@ -0,0 +1,42 @@ |
|||||||
|
From 54c1c6895ec53929d44153073a862521f6ed869d Mon Sep 17 00:00:00 2001 |
||||||
|
From: Karel Zak <kzak@redhat.com> |
||||||
|
Date: Tue, 24 Aug 2021 10:49:32 +0200 |
||||||
|
Subject: tests: make eject umount tests more robust |
||||||
|
|
||||||
|
Upstream: http://github.com/karelzak/util-linux/commit/abe16d0d34413555fbd621f90a0b93c2105116a2 |
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com> |
||||||
|
--- |
||||||
|
tests/ts/eject/umount | 3 +++ |
||||||
|
1 file changed, 3 insertions(+) |
||||||
|
|
||||||
|
diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount |
||||||
|
index 2be281ee3..04f53ed99 100755 |
||||||
|
--- a/tests/ts/eject/umount |
||||||
|
+++ b/tests/ts/eject/umount |
||||||
|
@@ -83,6 +83,7 @@ mkfs.ext2 -q -F $TS_DEVICE |
||||||
|
udevadm settle |
||||||
|
mkdir -p $TS_MOUNTPOINT |
||||||
|
$TS_CMD_MOUNT $TS_DEVICE $TS_MOUNTPOINT |
||||||
|
+udevadm settle |
||||||
|
$TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success" |
||||||
|
deinit_device |
||||||
|
ts_finalize_subtest |
||||||
|
@@ -95,6 +96,7 @@ mkdir -p ${TS_MOUNTPOINT}1 |
||||||
|
mkdir -p ${TS_MOUNTPOINT}2 |
||||||
|
$TS_CMD_MOUNT ${TS_DEVICE}1 ${TS_MOUNTPOINT}1 |
||||||
|
$TS_CMD_MOUNT ${TS_DEVICE}2 ${TS_MOUNTPOINT}2 |
||||||
|
+udevadm settle |
||||||
|
$TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success" |
||||||
|
deinit_device |
||||||
|
ts_finalize_subtest |
||||||
|
@@ -115,6 +117,7 @@ mkdir -p ${TS_MOUNTPOINT}1 |
||||||
|
mkdir -p ${TS_MOUNTPOINT}2 |
||||||
|
$TS_CMD_MOUNT ${TS_DEVICE}1 ${TS_MOUNTPOINT}1 |
||||||
|
$TS_CMD_MOUNT ${TS_DEVICE}2 ${TS_MOUNTPOINT}2 |
||||||
|
+udevadm settle |
||||||
|
$TS_CMD_EJECT --force ${TS_DEVICE}1 && ts_log "Success" |
||||||
|
deinit_device |
||||||
|
ts_finalize_subtest |
||||||
|
-- |
||||||
|
2.34.1 |
||||||
|
|
@ -0,0 +1,52 @@ |
|||||||
|
From 41ae35c39241575c63db204c786cb1423c202815 Mon Sep 17 00:00:00 2001 |
||||||
|
From: "Andrew G. Morgan" <morgan@kernel.org> |
||||||
|
Date: Sat, 27 Nov 2021 21:00:22 -0800 |
||||||
|
Subject: 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=2037212 |
||||||
|
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 3657f04cd..c62e91e94 100644 |
||||||
|
--- a/login-utils/login.c |
||||||
|
+++ b/login-utils/login.c |
||||||
|
@@ -1521,6 +1521,9 @@ int main(int argc, char **argv) |
||||||
|
|
||||||
|
child_argv[child_argc++] = 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(child_argv[0], child_argv + 1); |
||||||
|
|
||||||
|
if (!strcmp(child_argv[0], "/bin/sh")) |
||||||
|
diff --git a/login-utils/su-common.c b/login-utils/su-common.c |
||||||
|
index afd0ea8ad..7d4826bbc 100644 |
||||||
|
--- a/login-utils/su-common.c |
||||||
|
+++ b/login-utils/su-common.c |
||||||
|
@@ -1231,6 +1231,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.34.1 |
||||||
|
|
@ -0,0 +1,70 @@ |
|||||||
|
From a80ba745cc54d5ba726e48065aebe6dac50dedd2 Mon Sep 17 00:00:00 2001 |
||||||
|
From: Karel Zak <kzak@redhat.com> |
||||||
|
Date: Mon, 24 Jan 2022 14:08:08 +0100 |
||||||
|
Subject: uuidd: fix open/lock state issue |
||||||
|
|
||||||
|
* warn on open/lock state issue |
||||||
|
|
||||||
|
* enable access to /var/lib/libuuid/, because ProtectSystem=strict make it read-only |
||||||
|
|
||||||
|
openat(AT_FDCWD, "/var/lib/libuuid/clock.txt", |
||||||
|
O_RDWR|O_CREAT|O_CLOEXEC, 0660) = -1 EROFS (Read-only file system) |
||||||
|
|
||||||
|
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2040366 |
||||||
|
Upstream: http://github.com/util-linux/util-linux/commit/f27876f9c1056bf41fd940d5c4990b4277e0024f |
||||||
|
Upstream: http://github.com/util-linux/util-linux/commit/417982d0236a12756923d88e627f5e4facf8951c |
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com> |
||||||
|
--- |
||||||
|
misc-utils/uuidd.c | 9 ++++++--- |
||||||
|
misc-utils/uuidd.service.in | 1 + |
||||||
|
2 files changed, 7 insertions(+), 3 deletions(-) |
||||||
|
|
||||||
|
diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c |
||||||
|
index fa8db173b..78a37d2e8 100644 |
||||||
|
--- a/misc-utils/uuidd.c |
||||||
|
+++ b/misc-utils/uuidd.c |
||||||
|
@@ -494,7 +494,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path, |
||||||
|
break; |
||||||
|
case UUIDD_OP_TIME_UUID: |
||||||
|
num = 1; |
||||||
|
- __uuid_generate_time(uu, &num); |
||||||
|
+ if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet) |
||||||
|
+ warnx(_("failed to open/lock clock counter")); |
||||||
|
if (uuidd_cxt->debug) { |
||||||
|
uuid_unparse(uu, str); |
||||||
|
fprintf(stderr, _("Generated time UUID: %s\n"), str); |
||||||
|
@@ -504,7 +505,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path, |
||||||
|
break; |
||||||
|
case UUIDD_OP_RANDOM_UUID: |
||||||
|
num = 1; |
||||||
|
- __uuid_generate_random(uu, &num); |
||||||
|
+ if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet) |
||||||
|
+ warnx(_("failed to open/lock clock counter")); |
||||||
|
if (uuidd_cxt->debug) { |
||||||
|
uuid_unparse(uu, str); |
||||||
|
fprintf(stderr, _("Generated random UUID: %s\n"), str); |
||||||
|
@@ -513,7 +515,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path, |
||||||
|
reply_len = sizeof(uu); |
||||||
|
break; |
||||||
|
case UUIDD_OP_BULK_TIME_UUID: |
||||||
|
- __uuid_generate_time(uu, &num); |
||||||
|
+ if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet) |
||||||
|
+ warnx(_("failed to open/lock clock counter")); |
||||||
|
if (uuidd_cxt->debug) { |
||||||
|
uuid_unparse(uu, str); |
||||||
|
fprintf(stderr, P_("Generated time UUID %s " |
||||||
|
diff --git a/misc-utils/uuidd.service.in b/misc-utils/uuidd.service.in |
||||||
|
index b4c9c4635..e64ca59b5 100644 |
||||||
|
--- a/misc-utils/uuidd.service.in |
||||||
|
+++ b/misc-utils/uuidd.service.in |
||||||
|
@@ -18,6 +18,7 @@ ProtectKernelModules=yes |
||||||
|
ProtectControlGroups=yes |
||||||
|
RestrictAddressFamilies=AF_UNIX |
||||||
|
MemoryDenyWriteExecute=yes |
||||||
|
+ReadWritePaths=/var/lib/libuuid/ |
||||||
|
SystemCallFilter=@default @file-system @basic-io @system-service @signal @io-event @network-io |
||||||
|
|
||||||
|
[Install] |
||||||
|
-- |
||||||
|
2.34.1 |
||||||
|
|
@ -0,0 +1,51 @@ |
|||||||
|
From 9c45c4bf1a1a02ebaf9e24fd7d81d62c676eda7c Mon Sep 17 00:00:00 2001 |
||||||
|
From: Portisch <hugo.portisch@yahoo.de> |
||||||
|
Date: Mon, 8 Nov 2021 12:31:39 +0100 |
||||||
|
Subject: sysfs: fallback for partitions not including parent name |
||||||
|
|
||||||
|
Upstream: http://github.com/util-linux/util-linux/commit/9b59641bcec3df9c451eea4c7057751a153a3fcb |
||||||
|
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2021462 |
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com> |
||||||
|
--- |
||||||
|
lib/sysfs.c | 12 +++++++----- |
||||||
|
1 file changed, 7 insertions(+), 5 deletions(-) |
||||||
|
|
||||||
|
diff --git a/lib/sysfs.c b/lib/sysfs.c |
||||||
|
index bb7183319..191d870f6 100644 |
||||||
|
--- a/lib/sysfs.c |
||||||
|
+++ b/lib/sysfs.c |
||||||
|
@@ -210,9 +210,10 @@ int sysfs_blkdev_is_partition_dirent(DIR *dir, struct dirent *d, const char *par |
||||||
|
d->d_type != DT_UNKNOWN) |
||||||
|
return 0; |
||||||
|
#endif |
||||||
|
+ size_t len = 0; |
||||||
|
+ |
||||||
|
if (parent_name) { |
||||||
|
const char *p = parent_name; |
||||||
|
- size_t len; |
||||||
|
|
||||||
|
/* /dev/sda --> "sda" */ |
||||||
|
if (*parent_name == '/') { |
||||||
|
@@ -223,14 +224,15 @@ int sysfs_blkdev_is_partition_dirent(DIR *dir, struct dirent *d, const char *par |
||||||
|
} |
||||||
|
|
||||||
|
len = strlen(p); |
||||||
|
- if (strlen(d->d_name) <= len) |
||||||
|
- return 0; |
||||||
|
+ if ((strlen(d->d_name) <= len) || (strncmp(p, d->d_name, len) != 0)) |
||||||
|
+ len = 0; |
||||||
|
+ } |
||||||
|
|
||||||
|
+ if (len > 0) { |
||||||
|
/* partitions subdir name is |
||||||
|
* "<parent>[:digit:]" or "<parent>p[:digit:]" |
||||||
|
*/ |
||||||
|
- return strncmp(p, d->d_name, len) == 0 && |
||||||
|
- ((*(d->d_name + len) == 'p' && isdigit(*(d->d_name + len + 1))) |
||||||
|
+ return ((*(d->d_name + len) == 'p' && isdigit(*(d->d_name + len + 1))) |
||||||
|
|| isdigit(*(d->d_name + len))); |
||||||
|
} |
||||||
|
|
||||||
|
-- |
||||||
|
2.34.1 |
||||||
|
|
@ -0,0 +1,54 @@ |
|||||||
|
From 006aca565d4c8565baf05296b8e65ca4d5f203d3 Mon Sep 17 00:00:00 2001 |
||||||
|
From: Hans de Goede <hdegoede@redhat.com> |
||||||
|
Date: Fri, 30 Jul 2021 13:22:54 +0200 |
||||||
|
Subject: wdctl: Workaround reported boot-status bits not being present in |
||||||
|
wd->ident.options |
||||||
|
|
||||||
|
Some watchdog drivers are capable of reporting WDIOF_CARDRESET in their |
||||||
|
bootstatus, but they do not advertise this in the options field |
||||||
|
returned by the WDIOC_GETSUPPORT ioctl. |
||||||
|
|
||||||
|
This causes wdctl to not print the CARDRESET flag on these devices, |
||||||
|
even when the reset was caused by the watchdog and this is being |
||||||
|
reported in the WDIOC_GETBOOTSTATUS return. |
||||||
|
|
||||||
|
Add a workaround by or-ing any bits which are set in the status and |
||||||
|
bstatus returns into wd->ident.options so that reported flags will |
||||||
|
get printend independent of them being advertised as supported in |
||||||
|
wd->ident.options. |
||||||
|
|
||||||
|
This will make wdctl print a CARDRESET line when the system was |
||||||
|
actually reset by the watchdog while omitting it when it was not |
||||||
|
reset by the watchdog. At least on drivers which have the |
||||||
|
CARDRESET is missing from info.options problem. On other drivers |
||||||
|
the CARDRESET line will always be printend, but the actual reported |
||||||
|
value will change. |
||||||
|
|
||||||
|
Upstream: http://github.com/util-linux/util-linux/commit/b1b0259fe42aad1bf0997ce1c03a020ce59e38ab |
||||||
|
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2057046 |
||||||
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com> |
||||||
|
--- |
||||||
|
sys-utils/wdctl.c | 7 +++++++ |
||||||
|
1 file changed, 7 insertions(+) |
||||||
|
|
||||||
|
diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c |
||||||
|
index 8de5d5a2d..6b9affa0a 100644 |
||||||
|
--- a/sys-utils/wdctl.c |
||||||
|
+++ b/sys-utils/wdctl.c |
||||||
|
@@ -419,6 +419,13 @@ static int read_watchdog_from_device(struct wd_device *wd) |
||||||
|
ioctl(fd, WDIOC_GETSTATUS, &wd->status); |
||||||
|
ioctl(fd, WDIOC_GETBOOTSTATUS, &wd->bstatus); |
||||||
|
|
||||||
|
+ /* |
||||||
|
+ * Sometimes supported options like WDIOF_CARDRESET are missing from |
||||||
|
+ * ident.options, add anything set in status/bstatus to ident.options. |
||||||
|
+ */ |
||||||
|
+ wd->ident.options |= wd->status; |
||||||
|
+ wd->ident.options |= wd->bstatus; |
||||||
|
+ |
||||||
|
if (ioctl(fd, WDIOC_GETTIMEOUT, &wd->timeout) >= 0) |
||||||
|
wd->has_timeout = 1; |
||||||
|
if (ioctl(fd, WDIOC_GETPRETIMEOUT, &wd->pretimeout) >= 0) |
||||||
|
-- |
||||||
|
2.34.1 |
||||||
|
|
@ -0,0 +1,6 @@ |
|||||||
|
#%PAM-1.0 |
||||||
|
auth sufficient pam_rootok.so |
||||||
|
auth include system-auth |
||||||
|
account include system-auth |
||||||
|
password include system-auth |
||||||
|
session include system-auth |
@ -0,0 +1,16 @@ |
|||||||
|
#%PAM-1.0 |
||||||
|
auth substack system-auth |
||||||
|
auth include postlogin |
||||||
|
account required pam_nologin.so |
||||||
|
account include system-auth |
||||||
|
password include system-auth |
||||||
|
# pam_selinux.so close should be the first session rule |
||||||
|
session required pam_selinux.so close |
||||||
|
session required pam_loginuid.so |
||||||
|
# pam_selinux.so open should only be followed by sessions to be executed in the user context |
||||||
|
session required pam_selinux.so open |
||||||
|
session required pam_namespace.so |
||||||
|
session optional pam_keyinit.so force revoke |
||||||
|
session include system-auth |
||||||
|
session include postlogin |
||||||
|
-session optional pam_ck_connector.so |
@ -0,0 +1,15 @@ |
|||||||
|
#%PAM-1.0 |
||||||
|
auth substack password-auth |
||||||
|
auth include postlogin |
||||||
|
account required pam_nologin.so |
||||||
|
account include password-auth |
||||||
|
password include password-auth |
||||||
|
# pam_selinux.so close should be the first session rule |
||||||
|
session required pam_selinux.so close |
||||||
|
session required pam_loginuid.so |
||||||
|
# pam_selinux.so open should only be followed by sessions to be executed in the user context |
||||||
|
session required pam_selinux.so open |
||||||
|
session required pam_namespace.so |
||||||
|
session optional pam_keyinit.so force revoke |
||||||
|
session include password-auth |
||||||
|
session include postlogin |
@ -0,0 +1,5 @@ |
|||||||
|
#%PAM-1.0 |
||||||
|
auth include runuser |
||||||
|
session optional pam_keyinit.so force revoke |
||||||
|
-session optional pam_systemd.so |
||||||
|
session include runuser |
@ -0,0 +1,5 @@ |
|||||||
|
#%PAM-1.0 |
||||||
|
auth sufficient pam_rootok.so |
||||||
|
session optional pam_keyinit.so revoke |
||||||
|
session required pam_limits.so |
||||||
|
session required pam_unix.so |
@ -0,0 +1,6 @@ |
|||||||
|
#%PAM-1.0 |
||||||
|
auth include su |
||||||
|
account include su |
||||||
|
password include su |
||||||
|
session optional pam_keyinit.so force revoke |
||||||
|
session include su |
@ -0,0 +1,15 @@ |
|||||||
|
#%PAM-1.0 |
||||||
|
auth required pam_env.so |
||||||
|
auth sufficient pam_rootok.so |
||||||
|
# Uncomment the following line to implicitly trust users in the "wheel" group. |
||||||
|
#auth sufficient pam_wheel.so trust use_uid |
||||||
|
# Uncomment the following line to require a user to be in the "wheel" group. |
||||||
|
#auth required pam_wheel.so use_uid |
||||||
|
auth substack system-auth |
||||||
|
auth include postlogin |
||||||
|
account sufficient pam_succeed_if.so uid = 0 use_uid quiet |
||||||
|
account include system-auth |
||||||
|
password include system-auth |
||||||
|
session include system-auth |
||||||
|
session include postlogin |
||||||
|
session optional pam_xauth.so |
Loading…
Reference in new issue