import systemd-239-74.el8_8.3

i8c changed/i8c/systemd-239-74.el8_8.3
MSVSphere Packaging Team 1 year ago
parent d39da89a8b
commit 4754dbe96b

@ -0,0 +1,32 @@
From 1ac7d4d5ee3bb00a3e7d310f7b8803812940e0a4 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Thu, 14 Feb 2019 10:59:13 +0900
Subject: [PATCH] login: add a missing error check for session_set_leader()
session_set_leader() may fail. If it fails, then manager_start_scope()
will trigger assertion.
This may be related to RHBZ#1663704.
(cherry picked from commit fe3ab8458b9c0ead4b3e14ac25b342d8c34376fe)
Related: #2223602
---
src/login/logind-dbus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 81aacb4eed..5edcf4e43f 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -784,7 +784,9 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus
goto fail;
session_set_user(session, user);
- session_set_leader(session, leader);
+ r = session_set_leader(session, leader);
+ if (r < 0)
+ goto fail;
session->type = t;
session->class = c;

@ -0,0 +1,77 @@
From 33c66376740d069502ae807d0fa582865cddc359 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Wed, 5 Jul 2023 15:27:38 +0200
Subject: [PATCH] logind: reset session leader if we know for a fact that it is
gone
rhel-only
Related: #2223602
---
src/login/logind-dbus.c | 3 +++
src/login/logind-session.c | 18 ++++++++++++++++++
src/login/logind-session.h | 1 +
3 files changed, 22 insertions(+)
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 5edcf4e43f..dbac406035 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -3169,6 +3169,9 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err
session->scope_job = mfree(session->scope_job);
(void) session_jobs_reply(session, unit, result);
+ /* Scope job is done so leader should be gone as well. */
+ session_invalidate_leader(session);
+
session_save(session);
user_save(session->user);
}
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 916202a65a..c143202d0b 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -179,6 +179,23 @@ int session_set_leader(Session *s, pid_t pid) {
return 1;
}
+int session_invalidate_leader(Session *s) {
+ assert(s);
+
+ if (s->leader <= 0)
+ return 0;
+
+ if (pid_is_alive(s->leader))
+ return 0;
+
+ (void) hashmap_remove_value(s->manager->sessions_by_leader, PID_TO_PTR(s->leader), s);
+ s->leader = 0;
+
+ (void) session_save(s);
+
+ return 1;
+}
+
static void session_save_devices(Session *s, FILE *f) {
SessionDevice *sd;
Iterator i;
@@ -1096,6 +1113,7 @@ static int session_dispatch_fifo(sd_event_source *es, int fd, uint32_t revents,
/* EOF on the FIFO means the session died abnormally. */
session_remove_fifo(s);
+ session_invalidate_leader(s);
session_stop(s, false);
return 1;
diff --git a/src/login/logind-session.h b/src/login/logind-session.h
index 6678441bb9..0557696761 100644
--- a/src/login/logind-session.h
+++ b/src/login/logind-session.h
@@ -127,6 +127,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(Session *, session_free);
void session_set_user(Session *s, User *u);
int session_set_leader(Session *s, pid_t pid);
+int session_invalidate_leader(Session *s);
bool session_may_gc(Session *s, bool drop_not_started);
void session_add_to_gc_queue(Session *s);
int session_activate(Session *s);

@ -13,7 +13,7 @@
Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd
Version: 239
Release: 74%{?dist}.2
Release: 74%{?dist}.3
# For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+
Summary: System and Service Manager
@ -961,6 +961,8 @@ Patch0908: 0908-test-ignore-ENOMEDIUM-error-from-sd_pid_get_cgroup.patch
Patch0909: 0909-pstore-fix-crash-and-forward-dummy-arguments-instead.patch
Patch0910: 0910-ci-workflow-for-gathering-metadata-for-source-git-au.patch
Patch0911: 0911-ci-first-part-of-the-source-git-automation-commit-li.patch
Patch0912: 0912-login-add-a-missing-error-check-for-session_set_lead.patch
Patch0913: 0913-logind-reset-session-leader-if-we-know-for-a-fact-th.patch
%ifarch %{ix86} x86_64 aarch64
%global have_gnu_efi 1
@ -1591,9 +1593,13 @@ fi
%files tests -f .file-list-tests
%changelog
* Wed Jul 26 2023 MSVSphere Packaging Team <packager@msvsphere.ru> - 239-74.2
* Wed Jul 26 2023 MSVSphere Packaging Team <packager@msvsphere.ru> - 239-74.3
- Rebuilt for MSVSphere 8.8
* Thu Jul 20 2023 systemd maintenance team <systemd-maint@redhat.com> - 239-74.3
- login: add a missing error check for session_set_leader() (#2223602)
- logind: reset session leader if we know for a fact that it is gone (#2223602)
* Thu May 18 2023 systemd maintenance team <systemd-maint@redhat.com> - 239-74.2
- pstore: fix crash and forward dummy arguments instead of NULL (#2190153)
- ci: workflow for gathering metadata for source-git automation (#2190153)

Loading…
Cancel
Save