Avoid /tmp beging mounted as tmpfs without the user's will

(cherry picked from commit 389bc14c7517592e57b3f306d93b5ccc2741ef7a)
This commit is contained in:
zhangyao 2022-06-21 15:28:08 +08:00 committed by openeuler-sync-bot
parent 67e1fde681
commit 26db7ed93e
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From f58c5ced373c2532b5cc44ba2e0c3a28b41472f2 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Tue, 15 May 2018 09:24:20 +0200
Subject: [PATCH] Avoid /tmp being mounted as tmpfs without the user's
will
Conflict:adapt context; modify unit_add_dependency_by_name para because of
35d8c19ace6; don't modify because we need tmp.mount to be started when
basic.target is started.
Reference:https://git.centos.org/rpms/systemd/blob/4b8c80a811af8258c136f5e7000fc0cd0adf8dc5/f/SOURCES/0004-Avoid-tmp-being-mounted-as-tmpfs-without-the-user-s-.patch
Ensure PrivateTmp doesn't require tmpfs through tmp.mount, but rather
adds an After relationship.
Resolves: #1578772
---
src/core/unit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/unit.c b/src/core/unit.c
index fd84818..e30c14b 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1271,7 +1271,7 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
* tmp.mount so /tmp being masked is supported. However there's no reason to treat
* /tmp specifically and masking other mount units should be handled more
* gracefully too, see PR#16894. */
- r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_WANTS, "tmp.mount", true, UNIT_DEPENDENCY_FILE);
+ r = unit_add_dependency_by_name(u, UNIT_AFTER, "tmp.mount", true, UNIT_DEPENDENCY_FILE);
if (r < 0)
return r;
--
2.23.0

View File

@ -20,7 +20,7 @@
Name: systemd
Url: https://www.freedesktop.org/wiki/Software/systemd
Version: 249
Release: 29
Release: 30
License: MIT and LGPLv2+ and GPLv2+
Summary: System and Service Manager
@ -105,6 +105,7 @@ Patch6025: backport-Add-meson-option-to-disable-urlify.patch
Patch6026: backport-logind.conf-Fix-name-of-option-RuntimeDirectoryInode.patch
Patch6027: backport-unit-coldplug-both-job-and-nop_job-if-possible.patch
Patch6028: backport-meson.build-change-operator-combining-bools-from-to-.patch
Patch6029: backport-Avoid-tmp-being-mounted-as-tmpfs-without-the-user-s-.patch
BuildRequires: gcc, gcc-c++
BuildRequires: libcap-devel, libmount-devel, pam-devel, libselinux-devel
@ -1508,6 +1509,9 @@ fi
%{_libdir}/security/pam_systemd.so
%changelog
* Tue Jun 21 2022 zhangyao<zhangyao108@huawei.com> -249-30
- fix Avoid /tmp being mounted as tmpfs without the user's will
* Tue Jun 21 2022 wangyuhang<wangyuhang27@huawei.com> -249-29
- fix build fail on meson-0.6
1. delete invalid meson build option