systemd-252-7

Resolves: #1985288,#2172401
This commit is contained in:
Jan Macku 2023-02-27 15:01:29 +01:00
parent d005486d57
commit 5637d04f70
3 changed files with 103 additions and 1 deletions

View File

@ -0,0 +1,70 @@
From 138a7b2bc72a50ad7c590db3b638547dc2810e47 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Wed, 22 Feb 2023 16:43:42 +0100
Subject: [PATCH] test: add coverage for #24177
Original issue: https://bugzilla.redhat.com/show_bug.cgi?id=1985288
(cherry picked from commit 6299b6e5e6df32516fcaba9a93d966bad9043748)
Related: #1985288
---
test/units/testsuite-64.sh | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/test/units/testsuite-64.sh b/test/units/testsuite-64.sh
index 4017f61f59..201a673d06 100755
--- a/test/units/testsuite-64.sh
+++ b/test/units/testsuite-64.sh
@@ -417,7 +417,7 @@ testcase_lvm_basic() {
lvm vgs
lvm vgchange -ay "$vgroup"
lvm lvcreate -y -L 4M "$vgroup" -n mypart1
- lvm lvcreate -y -L 8M "$vgroup" -n mypart2
+ lvm lvcreate -y -L 32M "$vgroup" -n mypart2
lvm lvs
udevadm wait --settle --timeout="$timeout" "/dev/$vgroup/mypart1" "/dev/$vgroup/mypart2"
mkfs.ext4 -L mylvpart1 "/dev/$vgroup/mypart1"
@@ -461,6 +461,42 @@ testcase_lvm_basic() {
helper_check_device_symlinks "/dev/disk" "/dev/$vgroup"
helper_check_device_units
+ # Do not "unready" suspended encrypted devices w/o superblock info
+ # See:
+ # - https://github.com/systemd/systemd/pull/24177
+ # - https://bugzilla.redhat.com/show_bug.cgi?id=1985288
+ dd if=/dev/urandom of=/etc/lvm_keyfile bs=64 count=1 iflag=fullblock
+ chmod 0600 /etc/lvm_keyfile
+ # Intentionally use weaker cipher-related settings, since we don't care
+ # about security here as it's a throwaway LUKS partition
+ cryptsetup luksFormat -q --use-urandom --pbkdf pbkdf2 --pbkdf-force-iterations 1000 \
+ "/dev/$vgroup/mypart2" /etc/lvm_keyfile
+ # Mount the LUKS partition & create a filesystem on it
+ mkdir -p /tmp/lvmluksmnt
+ cryptsetup open --key-file=/etc/lvm_keyfile "/dev/$vgroup/mypart2" "lvmluksmap"
+ udevadm wait --settle --timeout="$timeout" "/dev/mapper/lvmluksmap"
+ mkfs.ext4 -L lvmluksfs "/dev/mapper/lvmluksmap"
+ udevadm wait --settle --timeout="$timeout" "/dev/disk/by-label/lvmluksfs"
+ # Make systemd "interested" in the mount by adding it to /etc/fstab
+ echo "/dev/disk/by-label/lvmluksfs /tmp/lvmluksmnt ext4 defaults 0 2" >>/etc/fstab
+ systemctl daemon-reload
+ mount "/tmp/lvmluksmnt"
+ mountpoint "/tmp/lvmluksmnt"
+ # Temporarily suspend the LUKS device and trigger udev - basically what `cryptsetup resize`
+ # does but in a more deterministic way suitable for a test/reproducer
+ for _ in {0..5}; do
+ dmsetup suspend "/dev/mapper/lvmluksmap"
+ udevadm trigger -v --settle "/dev/mapper/lvmluksmap"
+ dmsetup resume "/dev/mapper/lvmluksmap"
+ # The mount should survive this sequence of events
+ mountpoint "/tmp/lvmluksmnt"
+ done
+ # Cleanup
+ umount "/tmp/lvmluksmnt"
+ cryptsetup close "/dev/mapper/lvmluksmap"
+ sed -i "/lvmluksfs/d" "/etc/fstab"
+ systemctl daemon-reload
+
# Disable the VG and check symlinks...
lvm vgchange -an "$vgroup"
udevadm wait --settle --timeout="$timeout" --removed "/dev/$vgroup" "/dev/disk/by-label/mylvpart1"

View File

@ -0,0 +1,26 @@
From 0687c94b36c59b77f0e64137aadd2094f77cb9c3 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Tue, 21 Feb 2023 10:41:47 +0100
Subject: [PATCH] logind-session: make stopping of idle session visible to
admins
(cherry picked from commit 6269ffe7ee8a659df7336a2582054ecd9eecf4b1)
Resolves: #2172401
---
src/login/logind-session.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 5bd4abc474..709a585013 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -711,7 +711,7 @@ static int session_dispatch_stop_on_idle(sd_event_source *source, uint64_t t, vo
idle = session_get_idle_hint(s, &ts);
if (idle) {
- log_debug("Session \"%s\" of user \"%s\" is idle, stopping.", s->id, s->user->user_record->user_name);
+ log_info("Session \"%s\" of user \"%s\" is idle, stopping.", s->id, s->user->user_record->user_name);
return session_stop(s, /* force */ true);
}

View File

@ -21,7 +21,7 @@
Name: systemd
Url: https://www.freedesktop.org/wiki/Software/systemd
Version: 252
Release: 6%{?dist}
Release: 7%{?dist}
# For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+
Summary: System and Service Manager
@ -301,6 +301,8 @@ Patch0220: 0220-journalctl-actually-run-the-static-destructors.patch
Patch0221: 0221-efi-drop-executable-stack-bit-from-.elf-file.patch
Patch0222: 0222-install-fail-early-if-specifier-expansion-failed.patch
Patch0223: 0223-test-add-coverage-for-26467.patch
Patch0224: 0224-test-add-coverage-for-24177.patch
Patch0225: 0225-logind-session-make-stopping-of-idle-session-visible.patch
# Downstream-only patches (90009999)
@ -1092,6 +1094,10 @@ getent passwd systemd-oom &>/dev/null || useradd -r -l -g systemd-oom -d / -s /s
%files standalone-sysusers -f .file-list-standalone-sysusers
%changelog
* Mon Feb 27 2023 systemd maintenance team <systemd-maint@redhat.com> - 252-7
- test: add coverage for #24177 (#1985288)
- logind-session: make stopping of idle session visible to admins (#2172401)
* Wed Feb 22 2023 systemd maintenance team <systemd-maint@redhat.com> - 252-6
- journalctl: actually run the static destructors (#2122500)
- efi: drop executable-stack bit from .elf file (#2140646)