systemd-252-23

Resolves: RHEL-16354,RHEL-20757
This commit is contained in:
Jan Macku 2024-01-12 15:48:06 +01:00
parent 5718504336
commit 8e064030ef
5 changed files with 184 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From 58b968fc319f227fde22725f862063010c1c4138 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Tue, 12 Dec 2023 19:03:39 +0100
Subject: [PATCH] logind: don't setup idle session watch for lock-screen and
greeter
Reason to skip the idle session logic for these session classes is that
they are idle by default.
(cherry picked from commit 508b4786e8592e82eb4832549f74aaa54335d14c)
Related: RHEL-20757
---
man/logind.conf.xml | 9 +++++----
src/login/logind-session.c | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/man/logind.conf.xml b/man/logind.conf.xml
index 1a87cf6baf..55cbabaafb 100644
--- a/man/logind.conf.xml
+++ b/man/logind.conf.xml
@@ -348,10 +348,11 @@
<term><varname>StopIdleSessionSec=</varname></term>
<listitem><para>Specifies a timeout in seconds, or a time span value after which
- <filename>systemd-logind</filename> checks the idle state of all sessions. Every session that is idle for
- longer then the timeout will be stopped. Defaults to <literal>infinity</literal>
- (<filename>systemd-logind</filename> is not checking the idle state of sessions). For details about the syntax
- of time spans, see
+ <filename>systemd-logind</filename> checks the idle state of all sessions. Every session that is idle
+ for longer than the timeout will be stopped. Note that this option doesn't apply to
+ <literal>greeter</literal> or <literal>lock-screen</literal> sessions. Defaults to
+ <literal>infinity</literal> (<filename>systemd-logind</filename> is not checking the idle state
+ of sessions). For details about the syntax of time spans, see
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
</para></listitem>
</varlistentry>
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 709a585013..68c2aa9670 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -735,7 +735,7 @@ static int session_setup_stop_on_idle_timer(Session *s) {
assert(s);
- if (s->manager->stop_idle_session_usec == USEC_INFINITY)
+ if (s->manager->stop_idle_session_usec == USEC_INFINITY || IN_SET(s->class, SESSION_GREETER, SESSION_LOCK_SCREEN))
return 0;
r = sd_event_add_time_relative(

View File

@ -0,0 +1,33 @@
From 51dba4b4c93298e32442c88cd0bce7715eea289d Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 29 Nov 2023 11:07:08 +0100
Subject: [PATCH] logind: don't make idle action timer accuracy more coarse
than timeout
If we allow the timer accuracy to grow larger then the timeout itself
things are very confusing, because people might set a 1s time-out and we
turn that into 30s.
Hence, let's just cut off the 30s accuracy to the time-out itself, so
that we stay close to what users configured.
(cherry picked from commit e20bfa5005ab5458837bb62cb35bc1687f25124f)
Related: RHEL-20757
---
src/login/logind.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/login/logind.c b/src/login/logind.c
index 0348b19c05..70f72387c5 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -989,7 +989,7 @@ static int manager_dispatch_idle_action(sd_event_source *s, uint64_t t, void *us
m->event,
&m->idle_action_event_source,
CLOCK_MONOTONIC,
- elapse, USEC_PER_SEC*30,
+ elapse, MIN(USEC_PER_SEC*30, m->idle_action_usec), /* accuracy of 30s, but don't have an accuracy lower than the idle action timeout */
manager_dispatch_idle_action, m);
if (r < 0)
return log_error_errno(r, "Failed to add idle event source: %m");

View File

@ -0,0 +1,58 @@
From 468acdce5f4c6e5eaca7f348280e2491130e8d6d Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 29 Nov 2023 11:09:20 +0100
Subject: [PATCH] logind: do TTY idle logic only for sessions marked as "tty"
Otherwise things might be weird, because background sessions might
become "idle", wich doesn#t really make much sense.
This shouldn't change much in 99% of the cases, but slightly corrects
behaviour as it ensures only "primary"/"foreground" sessions get the
idle logic, i.e. where a user exists that could actually make it
non-idle.
(cherry picked from commit 20604ff219cf4027f4ee9ca9ba7c0b9e72aec448)
Related: RHEL-20757
---
src/login/logind-session.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 68c2aa9670..af5817e2b6 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -1029,19 +1029,21 @@ int session_get_idle_hint(Session *s, dual_timestamp *t) {
return s->idle_hint;
}
- /* For sessions with an explicitly configured tty, let's check its atime */
- if (s->tty) {
- r = get_tty_atime(s->tty, &atime);
- if (r >= 0)
- goto found_atime;
- }
+ if (s->type == SESSION_TTY) {
+ /* For sessions with an explicitly configured tty, let's check its atime */
+ if (s->tty) {
+ r = get_tty_atime(s->tty, &atime);
+ if (r >= 0)
+ goto found_atime;
+ }
- /* For sessions with a leader but no explicitly configured tty, let's check the controlling tty of
- * the leader */
- if (pid_is_valid(s->leader)) {
- r = get_process_ctty_atime(s->leader, &atime);
- if (r >= 0)
- goto found_atime;
+ /* For sessions with a leader but no explicitly configured tty, let's check the controlling tty of
+ * the leader */
+ if (pid_is_valid(s->leader)) {
+ r = get_process_ctty_atime(s->leader, &atime);
+ if (r >= 0)
+ goto found_atime;
+ }
}
if (t)

View File

@ -0,0 +1,32 @@
From f36dfb7ec1c780bdb74a4879fcce4be63adbaa6e Mon Sep 17 00:00:00 2001
From: Jan Janssen <medhefgo@web.de>
Date: Fri, 27 Jan 2023 14:28:58 +0100
Subject: [PATCH] meson: Properly install 90-uki-copy.install
(cherry picked from commit 4c181c1a33ef4de0130a131a2b332348dda672ed)
Resolves: RHEL-16354
---
src/kernel-install/meson.build | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/kernel-install/meson.build b/src/kernel-install/meson.build
index 68a4d43862..2ff62d5935 100644
--- a/src/kernel-install/meson.build
+++ b/src/kernel-install/meson.build
@@ -3,10 +3,13 @@
kernel_install_in = files('kernel-install.in')
loaderentry_install = files('90-loaderentry.install')
-uki_copy_install = files('90-uki-copy.install')
+kernel_install_files = files(
+ '50-depmod.install',
+ '90-uki-copy.install',
+)
if want_kernel_install
- install_data('50-depmod.install',
+ install_data(kernel_install_files,
loaderentry_install,
install_mode : 'rwxr-xr-x',
install_dir : kernelinstalldir)

View File

@ -21,7 +21,7 @@
Name: systemd
Url: https://systemd.io
Version: 252
Release: 22%{?dist}
Release: 23%{?dist}
# For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+
Summary: System and Service Manager
@ -533,6 +533,10 @@ Patch0452: 0452-man-mention-RHEL-documentation-in-systemctl-s-man-pa.patch
Patch0453: 0453-resolved-actually-check-authenticated-flag-of-SOA-tr.patch
Patch0454: 0454-udev-allow-denylist-for-reading-sysfs-attributes-whe.patch
Patch0455: 0455-man-environment-value-udev-property.patch
Patch0456: 0456-logind-don-t-setup-idle-session-watch-for-lock-scree.patch
Patch0457: 0457-logind-don-t-make-idle-action-timer-accuracy-more-co.patch
Patch0458: 0458-logind-do-TTY-idle-logic-only-for-sessions-marked-as.patch
Patch0459: 0459-meson-Properly-install-90-uki-copy.install.patch
# Downstream-only patches (90009999)
@ -1376,6 +1380,12 @@ getent passwd systemd-oom &>/dev/null || useradd -r -l -g systemd-oom -d / -s /s
%files standalone-sysusers -f .file-list-standalone-sysusers
%changelog
* Fri Jan 12 2024 systemd maintenance team <systemd-maint@redhat.com> - 252-23
- logind: don't setup idle session watch for lock-screen and greeter (RHEL-20757)
- logind: don't make idle action timer accuracy more coarse than timeout (RHEL-20757)
- logind: do TTY idle logic only for sessions marked as "tty" (RHEL-20757)
- meson: Properly install 90-uki-copy.install (RHEL-16354)
* Mon Jan 08 2024 systemd maintenance team <systemd-maint@redhat.com> - 252-22
- Revert "man: mention System Administrator's Guide in systemctl manpage" (RHEL-19436)
- man: mention RHEL documentation in systemctl's man page (RHEL-19436)