From f71e3dd3e66e6014602986e7667461cc34aa53d7 Mon Sep 17 00:00:00 2001 From: ExtinctFire Date: Thu, 3 Jun 2021 20:46:21 +0800 Subject: [PATCH] Fix migration from DynamicUser=yes to no. Signed-off-by: ExtinctFire --- ...migration-from-DynamicUser-yes-to-no.patch | 52 +++++++++++++++++++ systemd.spec | 9 +++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 backport-execute-Fix-migration-from-DynamicUser-yes-to-no.patch diff --git a/backport-execute-Fix-migration-from-DynamicUser-yes-to-no.patch b/backport-execute-Fix-migration-from-DynamicUser-yes-to-no.patch new file mode 100644 index 0000000..ac60fbc --- /dev/null +++ b/backport-execute-Fix-migration-from-DynamicUser-yes-to-no.patch @@ -0,0 +1,52 @@ +From 578dc69f2a60d6282acc2d06ce8a3bf8a9d8ada0 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Fri, 6 Mar 2020 15:56:28 +0900 +Subject: [PATCH 0007/6858] execute: Fix migration from DynamicUser=yes to no + +Closes #12131. +Reference: https://github.com/systemd/systemd/pull/15033/commits/578dc69f2a60d6282acc2d06ce8a3bf8a9d8ada0 +Conflict: remove the last arguement "NULL" of function "chase_symlinks" +--- + src/core/execute.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/src/core/execute.c b/src/core/execute.c +index 4595bb12dc..46b5c99ada 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -2247,7 +2247,7 @@ static int setup_exec_directory( + + if (type != EXEC_DIRECTORY_CONFIGURATION && + readlink_and_make_absolute(p, &target) >= 0) { +- _cleanup_free_ char *q = NULL; ++ _cleanup_free_ char *q = NULL, *q_resolved = NULL, *target_resolved = NULL; + + /* This already exists and is a symlink? Interesting. Maybe it's one created + * by DynamicUser=1 (see above)? +@@ -2256,13 +2256,22 @@ static int setup_exec_directory( + * since they all support the private/ symlink logic at least in some + * configurations, see above. */ + ++ r = chase_symlinks(target, NULL, 0, &target_resolved); ++ if (r < 0) ++ goto fail; ++ + q = path_join(params->prefix[type], "private", *rt); + if (!q) { + r = -ENOMEM; + goto fail; + } + +- if (path_equal(q, target)) { ++ /* /var/lib or friends may be symlinks. So, let's chase them also. */ ++ r = chase_symlinks(q, NULL, CHASE_NONEXISTENT, &q_resolved); ++ if (r < 0) ++ goto fail; ++ ++ if (path_equal(q_resolved, target_resolved)) { + + /* Hmm, apparently DynamicUser= was once turned on for this service, + * but is no longer. Let's move the directory back up. */ +-- +2.23.0 + diff --git a/systemd.spec b/systemd.spec index 978d33d..0f19bb1 100644 --- a/systemd.spec +++ b/systemd.spec @@ -16,7 +16,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 243 -Release: 35 +Release: 36 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -118,6 +118,7 @@ Patch0068: 0068-backport-journal-refresh-cached-credentials-of-stdout-strea Patch0069: 0069-backport-journald-rework-end-of-line-marker-handling-to-use-a.patch Patch0070: 0070-backport-journald-rework-pid-change-handling.patch Patch0071: 0071-backport-journald-enforce-longer-line-length-limit-during-set.patch +Patch0072: backport-execute-Fix-migration-from-DynamicUser-yes-to-no.patch #openEuler Patch9002: 1509-fix-journal-file-descriptors-leak-problems.patch @@ -1503,6 +1504,12 @@ fi %exclude /usr/share/man/man3/* %changelog +* Thu Jun 03 2021 ExtinctFire - 243-36 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Fix migration from DynamicUser=yes to no. + * Thu Jun 03 2021 shenyangyang - 243-35 - Type:bugfix - ID:NA -- Gitee