solve the memleak of pid1 and add some patches

This commit is contained in:
openeuler-basic 2020-04-27 17:42:53 +08:00
parent 90f1875bd9
commit bf6226aeee
21 changed files with 2394 additions and 2 deletions

View File

@ -0,0 +1,43 @@
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
Ensure PrivateTmp doesn't require tmpfs through tmp.mount, but rather
adds an After relationship.
Resolves: #1578772
---
src/core/unit.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/core/unit.c b/src/core/unit.c
index 10e314f..bb4836a 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1036,13 +1036,14 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
return 0;
if (c->private_tmp) {
- const char *p;
- FOREACH_STRING(p, "/tmp", "/var/tmp") {
- r = unit_require_mounts_for(u, p, UNIT_DEPENDENCY_FILE);
- if (r < 0)
- return r;
- }
+ r = unit_add_dependency_by_name(u, UNIT_AFTER, "tmp.mount", true, UNIT_DEPENDENCY_FILE);
+ if (r < 0)
+ return r;
+
+ r = unit_require_mounts_for(u, "/var/tmp", UNIT_DEPENDENCY_FILE);
+ if (r < 0)
+ return r;
r = unit_add_dependency_by_name(u, UNIT_AFTER, SPECIAL_TMPFILES_SETUP_SERVICE, true, UNIT_DEPENDENCY_FILE);
if (r < 0)
--
2.19.1

View File

@ -0,0 +1,25 @@
From 4c230d1d73e9f9a6d1fe654599a63881c344a00c Mon Sep 17 00:00:00 2001
From: openEuler Buildteam <buildteam@openeuler.org>
Date: Tue, 29 Jan 2019 22:54:34 -0500
Subject: [PATCH] Make systemd-udevd.service start after systemd-remount-fs.service.
---
units/systemd-udevd.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in
index 6a3814e..3b09923 100644
--- a/units/systemd-udevd.service.in
+++ b/units/systemd-udevd.service.in
@@ -11,7 +11,7 @@
Description=udev Kernel Device Manager
Documentation=man:systemd-udevd.service(8) man:udev(7)
DefaultDependencies=no
-After=systemd-sysusers.service systemd-hwdb-update.service
+After=systemd-sysusers.service systemd-hwdb-update.service systemd-remount-fs.service
Before=sysinit.target
ConditionPathIsReadWrite=/sys
--
1.8.3.1

View File

@ -0,0 +1,43 @@
From 9d0046ceca10911361137d6496987cb15ffff132 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Thu, 25 Jun 2015 09:20:59 +0200
Subject: [PATCH] Revert "core: one step back again, for nspawn we
actually can't wait for cgroups running empty since systemd will get exactly
zero notifications about it"
This reverts commit 743970d2ea6d08aa7c7bff8220f6b7702f2b1db7.
https://bugzilla.redhat.com/show_bug.cgi?id=1141137
https://github.com/systemd/systemd/pull/350
Resolves: #1703485
---
src/core/unit.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/src/core/unit.c b/src/core/unit.c
index 1cadcd4..10e314f 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -4799,16 +4799,7 @@ int unit_kill_context(
} else if (r > 0) {
- /* FIXME: For now, on the legacy hierarchy, we will not wait for the cgroup members to die if
- * we are running in a container or if this is a delegation unit, simply because cgroup
- * notification is unreliable in these cases. It doesn't work at all in containers, and outside
- * of containers it can be confused easily by left-over directories in the cgroup — which
- * however should not exist in non-delegated units. On the unified hierarchy that's different,
- * there we get proper events. Hence rely on them. */
-
- if (cg_unified_controller(SYSTEMD_CGROUP_CONTROLLER) > 0 ||
- (detect_container() == 0 && !unit_cgroup_delegate(u)))
- wait_for_exit = true;
+ wait_for_exit = true;
if (send_sighup) {
set_free(pid_set);
--
2.19.1

View File

@ -0,0 +1,29 @@
From 47b256d63ac092137fe44e27560a14ee4aa5b7c8 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Fri, 8 Feb 2019 10:54:34 +0100
Subject: Revert "sysctl.d: switch net.ipv4.conf.all.rp_filter
from 1 to 2"
This reverts commit 75c9af80cf3529c76988451e63f98010c86f48f1.
Resolves: #1653824
---
sysctl.d/50-default.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysctl.d/50-default.conf b/sysctl.d/50-default.conf
index b0645f3..e263cf0 100644
--- a/sysctl.d/50-default.conf
+++ b/sysctl.d/50-default.conf
@@ -22,7 +22,7 @@ kernel.sysrq = 16
kernel.core_uses_pid = 1
# Source route verification
-net.ipv4.conf.all.rp_filter = 2
+net.ipv4.conf.all.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.all.accept_source_route = 0
--
1.8.3.1

View File

@ -0,0 +1,41 @@
From 66ca4903ca74604b193802635d36c48b0fcaf291 Mon Sep 17 00:00:00 2001
From: Topi Miettinen <toiwoton@gmail.com>
Date: Thu, 2 Jan 2020 19:59:48 +0200
Subject: [PATCH] dbus-execute: avoid extra strdup()
bind_mount_add does the strdup(), so we can avoid
strdup()ing the strings.
https://github.com/systemd/systemd/commit/66ca4903ca74604b193802635d36c48b0fcaf291
---
src/core/dbus-execute.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 2be3db2..abd60ea 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -2370,7 +2370,7 @@ int bus_exec_context_set_transient_property(
return 1;
} else if (STR_IN_SET(name, "BindPaths", "BindReadOnlyPaths")) {
- const char *source, *destination;
+ char *source, *destination;
int ignore_enoent;
uint64_t mount_flags;
bool empty = true;
@@ -2391,8 +2391,8 @@ int bus_exec_context_set_transient_property(
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
r = bind_mount_add(&c->bind_mounts, &c->n_bind_mounts,
&(BindMount) {
- .source = strdup(source),
- .destination = strdup(destination),
+ .source = source,
+ .destination = destination,
.read_only = !!strstr(name, "ReadOnly"),
.recursive = !!(mount_flags & MS_REC),
.ignore_enoent = ignore_enoent,
--
2.19.1

View File

@ -0,0 +1,33 @@
From 43681c404794341a42ba0a34b9730103f4f2c560 Mon Sep 17 00:00:00 2001
From: Gaurav <g.gupta@samsung.com>
Date: Mon, 8 Apr 2019 10:13:26 +0530
Subject: [PATCH] Fix fd leak in no memory condition
In case of no memory situation, fd is not being close.
Please review.
https://github.com/systemd/systemd/commit/43681c404794341a42ba0a34b9730103f4f2c560.patch
---
src/libsystemd/sd-event/sd-event.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index 5adbcee..5d0e057 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -900,8 +900,10 @@ _public_ int sd_event_add_io(
assert_return(!event_pid_changed(e), -ECHILD);
s = source_new(e, !ret, SOURCE_IO);
- if (!s)
+ if (!s) {
+ fd = safe_close(fd);
return -ENOMEM;
+ }
s->wakeup = WAKEUP_EVENT_SOURCE;
s->io.fd = fd;
--
2.19.1

View File

@ -0,0 +1,28 @@
From 7a650ee8d3faf79fd5ef866b69741880a3a42b8d Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Thu, 2 May 2019 14:11:54 +0200
Subject: [PATCH] journal: don't enable systemd-journald-audit.socket
by default
Resolves: #1699287
---
units/systemd-journald.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/systemd-journald.service.in b/units/systemd-journald.service.in
index 089bc38..7436619 100644
--- a/units/systemd-journald.service.in
+++ b/units/systemd-journald.service.in
@@ -31,7 +31,7 @@ RestrictAddressFamilies=AF_UNIX AF_NETLINK
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
-Sockets=systemd-journald.socket systemd-journald-dev-log.socket systemd-journald-audit.socket
+Sockets=systemd-journald.socket systemd-journald-dev-log.socket
StandardOutput=null
SystemCallArchitectures=native
SystemCallErrorNumber=EPERM
--
2.19.1

View File

@ -0,0 +1,53 @@
From 0b3833d6c3b751c6dfb40eeb2ef852984c58f546 Mon Sep 17 00:00:00 2001
From: openEuler Buildteam <buildteam@openeuler.org>
Date: Wed, 1 Aug 2018 10:58:28 +0200
Subject: logind: set RemoveIPC to false by default
Resolves: #1523233
---
man/logind.conf.xml | 2 +-
src/login/logind-core.c | 2 +-
src/login/logind.conf.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/man/logind.conf.xml b/man/logind.conf.xml
index 4cbfd09..c6ff5c3 100644
--- a/man/logind.conf.xml
+++ b/man/logind.conf.xml
@@ -327,7 +327,7 @@
user fully logs out. Takes a boolean argument. If enabled, the user may not consume IPC resources after the
last of the user's sessions terminated. This covers System V semaphores, shared memory and message queues, as
well as POSIX shared memory and message queues. Note that IPC objects of the root user and other system users
- are excluded from the effect of this setting. Defaults to <literal>yes</literal>.</para></listitem>
+ are excluded from the effect of this setting. Defaults to <literal>no</literal>.</para></listitem>
</varlistentry>
</variablelist>
diff --git a/src/login/logind-core.c b/src/login/logind-core.c
index 1d21e90..2ac7860 100644
--- a/src/login/logind-core.c
+++ b/src/login/logind-core.c
@@ -34,7 +34,7 @@ void manager_reset_config(Manager *m) {
m->n_autovts = 6;
m->reserve_vt = 6;
- m->remove_ipc = true;
+ m->remove_ipc = false;
m->inhibit_delay_max = 5 * USEC_PER_SEC;
m->user_stop_delay = 10 * USEC_PER_SEC;
diff --git a/src/login/logind.conf.in b/src/login/logind.conf.in
index 1029e29..c7346f9 100644
--- a/src/login/logind.conf.in
+++ b/src/login/logind.conf.in
@@ -32,6 +32,6 @@
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
-#RemoveIPC=yes
+#RemoveIPC=no
#InhibitorsMax=8192
#SessionsMax=8192
--
2.19.1

View File

@ -0,0 +1,93 @@
From e67cd21d7d174cdafd12beca4cfb6e19e61f6fb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 8 Jul 2019 17:33:25 +0200
Subject: [PATCH] analyze: add "unit-files" to dump the unit fragment map
I'm not convinced that this is useful enough to be included... But it is
certainly nice when debugging.
revert analyze add unit files to dump the unit fragment map
---
src/analyze/analyze.c | 50 --------------------------------------------------
1 file changed, 50 deletions(-)
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 322be1a..6de26f4 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -1546,53 +1546,6 @@ static int get_or_set_log_target(int argc, char *argv[], void *userdata) {
return (argc == 1) ? get_log_target(argc, argv, userdata) : set_log_target(argc, argv, userdata);
}
-static bool strv_fnmatch_strv_or_empty(char* const* patterns, char **strv, int flags) {
- char **s;
- STRV_FOREACH(s, strv)
- if (strv_fnmatch_or_empty(patterns, *s, flags))
- return true;
-
- return false;
-}
-
-static int do_unit_files(int argc, char *argv[], void *userdata) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
- _cleanup_hashmap_free_ Hashmap *unit_ids = NULL;
- _cleanup_hashmap_free_ Hashmap *unit_names = NULL;
- char **patterns = strv_skip(argv, 1);
- Iterator i;
- const char *k, *dst;
- char **v;
- int r;
-
- r = lookup_paths_init(&lp, arg_scope, 0, NULL);
- if (r < 0)
- return log_error_errno(r, "lookup_paths_init() failed: %m");
-
- r = unit_file_build_name_map(&lp, &unit_ids, &unit_names, NULL);
- if (r < 0)
- return log_error_errno(r, "unit_file_build_name_map() failed: %m");
-
- HASHMAP_FOREACH_KEY(dst, k, unit_ids, i) {
- if (!strv_fnmatch_or_empty(patterns, k, FNM_NOESCAPE) &&
- !strv_fnmatch_or_empty(patterns, dst, FNM_NOESCAPE))
- continue;
-
- printf("ids: %s → %s\n", k, dst);
- }
-
- HASHMAP_FOREACH_KEY(v, k, unit_names, i) {
- if (!strv_fnmatch_or_empty(patterns, k, FNM_NOESCAPE) &&
- !strv_fnmatch_strv_or_empty(patterns, v, FNM_NOESCAPE))
- continue;
-
- _cleanup_free_ char *j = strv_join(v, ", ");
- printf("aliases: %s ← %s\n", k, j);
- }
-
- return 0;
-}
-
static int dump_unit_paths(int argc, char *argv[], void *userdata) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
int r;
@@ -2263,7 +2216,6 @@ static int help(int argc, char *argv[], void *userdata) {
" log-target [TARGET] Get/set logging target for manager\n"
" dump Output state serialization of service manager\n"
" cat-config Show configuration file and drop-ins\n"
- " unit-files List files and symlinks for units\n"
" unit-paths List load directories for units\n"
" exit-status [STATUS...] List exit status definitions\n"
" syscall-filter [NAME...] Print list of syscalls in seccomp filter\n"
@@ -2467,10 +2419,8 @@ static int run(int argc, char *argv[]) {
{ "get-log-level", VERB_ANY, 1, 0, get_log_level },
{ "set-log-target", 2, 2, 0, set_log_target },
{ "get-log-target", VERB_ANY, 1, 0, get_log_target },
-
{ "dump", VERB_ANY, 1, 0, dump },
{ "cat-config", 2, VERB_ANY, 0, cat_config },
- { "unit-files", VERB_ANY, VERB_ANY, 0, do_unit_files },
{ "unit-paths", 1, 1, 0, dump_unit_paths },
{ "exit-status", VERB_ANY, VERB_ANY, 0, dump_exit_status },
{ "syscall-filter", VERB_ANY, VERB_ANY, 0, dump_syscall_filters },
--
1.8.3.1

View File

@ -0,0 +1,289 @@
From 91e0ee5f16321656ed6f827742ecbeb2b36027f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 10 Jul 2019 18:01:13 +0200
Subject: [PATCH] pid1: drop unit caches only based on mtime
v2:
- do not watch mtime of transient and generated dirs
We'd reload the map after every transient unit we created, which we don't
need to do, since we create those units ourselves and know their fragment
path.
revert pid1 drop unit caches only based on mtime
---
src/analyze/analyze.c | 2 +-
src/core/load-fragment.c | 9 --------
src/core/manager.c | 14 ++++++++++--
src/core/manager.h | 1 -
src/shared/unit-file.c | 57 +----------------------------------------------
src/shared/unit-file.h | 2 --
src/systemctl/systemctl.c | 2 +-
src/test/test-unit-file.c | 13 +----------
8 files changed, 16 insertions(+), 84 deletions(-)
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 4d81026..322be1a 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -1569,7 +1569,7 @@ static int do_unit_files(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "lookup_paths_init() failed: %m");
- r = unit_file_build_name_map(&lp, NULL, &unit_ids, &unit_names, NULL);
+ r = unit_file_build_name_map(&lp, &unit_ids, &unit_names, NULL);
if (r < 0)
return log_error_errno(r, "unit_file_build_name_map() failed: %m");
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 8eaf8b3..9821a92 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -4605,15 +4605,6 @@ int unit_load_fragment(Unit *u) {
return 0;
}
- /* Possibly rebuild the fragment map to catch new units */
- r = unit_file_build_name_map(&u->manager->lookup_paths,
- &u->manager->unit_cache_mtime,
- &u->manager->unit_id_map,
- &u->manager->unit_name_map,
- &u->manager->unit_path_cache);
- if (r < 0)
- log_error_errno(r, "Failed to rebuild name map: %m");
-
r = unit_file_find_fragment(u->manager->unit_id_map,
u->manager->unit_name_map,
u->id,
diff --git a/src/core/manager.c b/src/core/manager.c
index 5efcf45..8b1ce70 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -693,7 +693,6 @@ static void manager_free_unit_name_maps(Manager *m) {
m->unit_id_map = hashmap_free(m->unit_id_map);
m->unit_name_map = hashmap_free(m->unit_name_map);
m->unit_path_cache = set_free_free(m->unit_path_cache);
- m->unit_cache_mtime = 0;
}
static int manager_setup_run_queue(Manager *m) {
@@ -1642,6 +1641,11 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
lookup_paths_log(&m->lookup_paths);
+ manager_free_unit_name_maps(m);
+ r = unit_file_build_name_map(&m->lookup_paths, &m->unit_id_map, &m->unit_name_map, &m->unit_path_cache);
+ if (r < 0)
+ return log_error_errno(r, "Failed to build name map: %m");
+
{
/* This block is (optionally) done with the reloading counter bumped */
_cleanup_(manager_reloading_stopp) Manager *reloading = NULL;
@@ -2858,6 +2862,10 @@ int manager_loop(Manager *m) {
assert(m);
assert(m->objective == MANAGER_OK); /* Ensure manager_startup() has been called */
+ /* Release the path and unit name caches */
+ manager_free_unit_name_maps(m);
+ // FIXME: once this happens, we cannot load any more units
+
manager_check_finished(m);
/* There might still be some zombies hanging around from before we were exec()'ed. Let's reap them. */
@@ -3531,8 +3539,10 @@ int manager_reload(Manager *m) {
lookup_paths_log(&m->lookup_paths);
- /* We flushed out generated files, for which we don't watch mtime, so we should flush the old map. */
manager_free_unit_name_maps(m);
+ r = unit_file_build_name_map(&m->lookup_paths, &m->unit_id_map, &m->unit_name_map, &m->unit_path_cache);
+ if (r < 0)
+ log_warning_errno(r, "Failed to build name map: %m");
/* First, enumerate what we can from kernel and suchlike */
manager_enumerate_perpetual(m);
diff --git a/src/core/manager.h b/src/core/manager.h
index 815c5ec..9ca82ac 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -223,7 +223,6 @@ struct Manager {
Hashmap *unit_id_map;
Hashmap *unit_name_map;
Set *unit_path_cache;
- usec_t unit_cache_mtime;
char **transient_environment; /* The environment, as determined from config files, kernel cmdline and environment generators */
char **client_environment; /* Environment variables created by clients through the bus API */
diff --git a/src/shared/unit-file.c b/src/shared/unit-file.c
index 4a5f23e..bad92a3 100644
--- a/src/shared/unit-file.c
+++ b/src/shared/unit-file.c
@@ -152,47 +152,8 @@ static int unit_ids_map_get(
return -ELOOP;
}
-static bool lookup_paths_mtime_exclude(const LookupPaths *lp, const char *path) {
- /* Paths that are under our exclusive control. Users shall not alter those directly. */
-
- return streq_ptr(path, lp->generator) ||
- streq_ptr(path, lp->generator_early) ||
- streq_ptr(path, lp->generator_late) ||
- streq_ptr(path, lp->transient) ||
- streq_ptr(path, lp->persistent_control) ||
- streq_ptr(path, lp->runtime_control);
-}
-
-static bool lookup_paths_mtime_good(const LookupPaths *lp, usec_t mtime) {
- char **dir;
-
- STRV_FOREACH(dir, (char**) lp->search_path) {
- struct stat st;
-
- if (lookup_paths_mtime_exclude(lp, *dir))
- continue;
-
- /* Determine the latest lookup path modification time */
- if (stat(*dir, &st) < 0) {
- if (errno == ENOENT)
- continue;
-
- log_debug_errno(errno, "Failed to stat %s, ignoring: %m", *dir);
- continue;
- }
-
- if (timespec_load(&st.st_mtim) > mtime) {
- log_debug_errno(errno, "Unit dir %s has changed, need to update cache.", *dir);
- return false;
- }
- }
-
- return true;
-}
-
int unit_file_build_name_map(
const LookupPaths *lp,
- usec_t *cache_mtime,
Hashmap **ret_unit_ids_map,
Hashmap **ret_unit_names_map,
Set **ret_path_cache) {
@@ -210,12 +171,6 @@ int unit_file_build_name_map(
_cleanup_set_free_free_ Set *paths = NULL;
char **dir;
int r;
- usec_t mtime = 0;
-
- /* Before doing anything, check if the mtime that was passed is still valid. If
- * yes, do nothing. If *cache_time == 0, always build the cache. */
- if (cache_mtime && *cache_mtime > 0 && lookup_paths_mtime_good(lp, *cache_mtime))
- return 0;
if (ret_path_cache) {
paths = set_new(&path_hash_ops);
@@ -226,7 +181,6 @@ int unit_file_build_name_map(
STRV_FOREACH(dir, (char**) lp->search_path) {
struct dirent *de;
_cleanup_closedir_ DIR *d = NULL;
- struct stat st;
d = opendir(*dir);
if (!d) {
@@ -235,13 +189,6 @@ int unit_file_build_name_map(
continue;
}
- /* Determine the latest lookup path modification time */
- if (fstat(dirfd(d), &st) < 0)
- return log_error_errno(errno, "Failed to fstat %s: %m", *dir);
-
- if (!lookup_paths_mtime_exclude(lp, *dir))
- mtime = MAX(mtime, timespec_load(&st.st_mtim));
-
FOREACH_DIRENT_ALL(de, d, log_warning_errno(errno, "Failed to read \"%s\", ignoring: %m", *dir)) {
char *filename;
_cleanup_free_ char *_filename_free = NULL, *simplified = NULL;
@@ -378,14 +325,12 @@ int unit_file_build_name_map(
basename(dst), src);
}
- if (cache_mtime)
- *cache_mtime = mtime;
*ret_unit_ids_map = TAKE_PTR(ids);
*ret_unit_names_map = TAKE_PTR(names);
if (ret_path_cache)
*ret_path_cache = TAKE_PTR(paths);
- return 1;
+ return 0;
}
int unit_file_find_fragment(
diff --git a/src/shared/unit-file.h b/src/shared/unit-file.h
index 54cc787..52e17f7 100644
--- a/src/shared/unit-file.h
+++ b/src/shared/unit-file.h
@@ -4,7 +4,6 @@
#include <stdbool.h>
#include "hashmap.h"
-#include "time-util.h"
#include "unit-name.h"
typedef enum UnitFileState UnitFileState;
@@ -43,7 +42,6 @@ int unit_validate_alias_symlink_and_warn(const char *filename, const char *targe
int unit_file_build_name_map(
const LookupPaths *lp,
- usec_t *ret_time,
Hashmap **ret_unit_ids_map,
Hashmap **ret_unit_names_map,
Set **ret_path_cache);
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index dcf76be..69063ee 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2594,7 +2594,7 @@ static int unit_find_paths(
_cleanup_set_free_free_ Set *names = NULL;
if (!cached_name_map) {
- r = unit_file_build_name_map(lp, NULL, &cached_id_map, &cached_name_map, NULL);
+ r = unit_file_build_name_map(lp, &cached_id_map, &cached_name_map, NULL);
if (r < 0)
return r;
}
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
index 8bc5bf6..988ac15 100644
--- a/src/test/test-unit-file.c
+++ b/src/test/test-unit-file.c
@@ -32,12 +32,10 @@ static void test_unit_file_build_name_map(char **ids) {
Iterator i;
const char *k, *dst;
char **v;
- usec_t mtime = 0;
- int r;
assert_se(lookup_paths_init(&lp, UNIT_FILE_SYSTEM, 0, NULL) >= 0);
- assert_se(unit_file_build_name_map(&lp, &mtime, &unit_ids, &unit_names, NULL) == 1);
+ assert_se(unit_file_build_name_map(&lp, &unit_ids, &unit_names, NULL) == 0);
HASHMAP_FOREACH_KEY(dst, k, unit_ids, i)
log_info("ids: %s → %s", k, dst);
@@ -47,15 +45,6 @@ static void test_unit_file_build_name_map(char **ids) {
log_info("aliases: %s ← %s", k, j);
}
- char buf[FORMAT_TIMESTAMP_MAX];
- log_debug("Last modification time: %s", format_timestamp(buf, sizeof buf, mtime));
-
- r = unit_file_build_name_map(&lp, &mtime, &unit_ids, &unit_names, NULL);
- assert_se(IN_SET(r, 0, 1));
- if (r == 0)
- log_debug("Cache rebuild skipped based on mtime.");
-
-
char **id;
STRV_FOREACH(id, ids) {
const char *fragment, *name;
--
1.8.3.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,177 @@
From 7d1e91d1a9504ab1bc03894038f90a8e87a4e982 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 2 Apr 2019 11:22:56 +0200
Subject: [PATCH] shared/unit-file: add a function to validate unit alias
symlinks
It turns out most possible symlinks are invalid, because the type has to match,
and template units can only be linked to template units.
I'm not sure if the existing code made the same checks consistently. At least
I don't see the same rules expressed in a single place.
revert shared unit file add a function to validate unit alias symlinks
---
src/shared/unit-file.c | 73 -----------------------------------------------
src/shared/unit-file.h | 2 --
src/test/meson.build | 4 ---
src/test/test-unit-file.c | 34 ----------------------
4 files changed, 113 deletions(-)
delete mode 100644 src/test/test-unit-file.c
diff --git a/src/shared/unit-file.c b/src/shared/unit-file.c
index cde38c4..deed7dc 100644
--- a/src/shared/unit-file.c
+++ b/src/shared/unit-file.c
@@ -1,7 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "macro.h"
-#include "string-util.h"
#include "unit-file.h"
bool unit_type_may_alias(UnitType type) {
@@ -22,75 +21,3 @@ bool unit_type_may_template(UnitType type) {
UNIT_TIMER,
UNIT_PATH);
}
-
-int unit_validate_alias_symlink_and_warn(const char *filename, const char *target) {
- const char *src, *dst;
- _cleanup_free_ char *src_instance = NULL, *dst_instance = NULL;
- UnitType src_unit_type, dst_unit_type;
- int src_name_type, dst_name_type;
-
- /* Check if the *alias* symlink is valid. This applies to symlinks like
- * /etc/systemd/system/dbus.service → dbus-broker.service, but not to .wants or .requires symlinks
- * and such. Neither does this apply to symlinks which *link* units, i.e. symlinks to outside of the
- * unit lookup path.
- *
- * -EINVAL is returned if the something is wrong with the source filename or the source unit type is
- * not allowed to symlink,
- * -EXDEV if the target filename is not a valid unit name or doesn't match the source.
- */
-
- src = basename(filename);
- dst = basename(target);
-
- /* src checks */
-
- src_name_type = unit_name_to_instance(src, &src_instance);
- if (src_name_type < 0)
- return log_notice_errno(src_name_type,
- "%s: not a valid unit name \"%s\": %m", filename, src);
-
- src_unit_type = unit_name_to_type(src);
- assert(src_unit_type >= 0); /* unit_name_to_instance() checked the suffix already */
-
- if (!unit_type_may_alias(src_unit_type))
- return log_notice_errno(SYNTHETIC_ERRNO(EINVAL),
- "%s: symlinks are not allowed for units of this type, rejecting.",
- filename);
-
- if (src_name_type != UNIT_NAME_PLAIN &&
- !unit_type_may_template(src_unit_type))
- return log_notice_errno(SYNTHETIC_ERRNO(EINVAL),
- "%s: templates not allowed for %s units, rejecting.",
- filename, unit_type_to_string(src_unit_type));
-
- /* dst checks */
-
- dst_name_type = unit_name_to_instance(dst, &dst_instance);
- if (dst_name_type < 0)
- return log_notice_errno(dst_name_type == -EINVAL ? SYNTHETIC_ERRNO(EXDEV) : dst_name_type,
- "%s points to \"%s\" which is not a valid unit name: %m",
- filename, dst);
-
- if (!(dst_name_type == src_name_type ||
- (src_name_type == UNIT_NAME_INSTANCE && dst_name_type == UNIT_NAME_TEMPLATE)))
- return log_notice_errno(SYNTHETIC_ERRNO(EXDEV),
- "%s: symlink target name type \"%s\" does not match source, rejecting.",
- filename, dst);
-
- if (dst_name_type == UNIT_NAME_INSTANCE) {
- assert(src_instance);
- assert(dst_instance);
- if (!streq(src_instance, dst_instance))
- return log_notice_errno(SYNTHETIC_ERRNO(EXDEV),
- "%s: unit symlink target \"%s\" instance name doesn't match, rejecting.",
- filename, dst);
- }
-
- dst_unit_type = unit_name_to_type(dst);
- if (dst_unit_type != src_unit_type)
- return log_notice_errno(SYNTHETIC_ERRNO(EXDEV),
- "%s: symlink target \"%s\" has incompatible suffix, rejecting.",
- filename, dst);
-
- return 0;
-}
diff --git a/src/shared/unit-file.h b/src/shared/unit-file.h
index e57f472..2b9df65 100644
--- a/src/shared/unit-file.h
+++ b/src/shared/unit-file.h
@@ -35,5 +35,3 @@ enum UnitFileScope {
bool unit_type_may_alias(UnitType type) _const_;
bool unit_type_may_template(UnitType type) _const_;
-
-int unit_validate_alias_symlink_and_warn(const char *filename, const char *target);
diff --git a/src/test/meson.build b/src/test/meson.build
index de31e97..5625e68 100644
--- a/src/test/meson.build
+++ b/src/test/meson.build
@@ -137,10 +137,6 @@ tests += [
[],
'ENABLE_EFI'],
- [['src/test/test-unit-file.c'],
- [],
- []],
-
[['src/test/test-unit-name.c',
'src/test/test-helper.c'],
[libcore,
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
deleted file mode 100644
index b626b5f..0000000
--- a/src/test/test-unit-file.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1+ */
-
-#include "path-lookup.h"
-#include "set.h"
-#include "strv.h"
-#include "tests.h"
-#include "unit-file.h"
-
-static void test_unit_validate_alias_symlink_and_warn(void) {
- log_info("/* %s */", __func__);
-
- assert_se(unit_validate_alias_symlink_and_warn("/path/a.service", "/other/b.service") == 0);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a.service", "/other/b.socket") == -EXDEV);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a.service", "/other/b.foobar") == -EXDEV);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a@.service", "/other/b@.service") == 0);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a@.service", "/other/b@.socket") == -EXDEV);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a@XXX.service", "/other/b@YYY.service") == -EXDEV);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a@XXX.service", "/other/b@YYY.socket") == -EXDEV);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a@.service", "/other/b@YYY.service") == -EXDEV);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a@XXX.service", "/other/b@XXX.service") == 0);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a@XXX.service", "/other/b@.service") == 0);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a@.service", "/other/b.service") == -EXDEV);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a.service", "/other/b@.service") == -EXDEV);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a@.slice", "/other/b.slice") == -EINVAL);
- assert_se(unit_validate_alias_symlink_and_warn("/path/a.slice", "/other/b.slice") == -EINVAL);
-}
-
-int main(int argc, char **argv) {
- test_setup_logging(LOG_DEBUG);
-
- test_unit_validate_alias_symlink_and_warn();
-
- return 0;
-}
--
1.8.3.1

View File

@ -0,0 +1,43 @@
From 1255584bb0a595fb555af7e14230ab1b7aa6adcd Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Tue, 12 Feb 2019 16:58:16 +0100
Subject: [PATCH] rules: add elevator= kernel command line parameter
Kernel removed the elevator= option
Resolves: #1670126
---
rules/40-elevator.rules | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 rules/40-elevator.rules
diff --git a/rules/40-elevator.rules b/rules/40-elevator.rules
new file mode 100644
index 0000000..dbe8fc8
--- /dev/null
+++ b/rules/40-elevator.rules
@@ -0,0 +1,20 @@
+# We aren't adding devices skip the elevator check
+ACTION!="add", GOTO="sched_out"
+
+SUBSYSTEM!="block", GOTO="sched_out"
+ENV{DEVTYPE}!="disk", GOTO="sched_out"
+
+# Technically, dm-multipath can be configured to use an I/O scheduler.
+# However, there are races between the 'add' uevent and the linking in
+# of the queue/scheduler sysfs file. For now, just skip dm- devices.
+KERNEL=="dm-*|md*", GOTO="sched_out"
+
+# Skip bio-based devices, which don't support an I/O scheduler.
+ATTR{queue/scheduler}=="none", GOTO="sched_out"
+
+# If elevator= is specified on the kernel command line, change the
+# scheduler to the one specified.
+IMPORT{cmdline}="elevator"
+ENV{elevator}!="", ATTR{queue/scheduler}="$env{elevator}"
+
+LABEL="sched_out"
--
1.8.3.1

View File

@ -0,0 +1,40 @@
From 2991b22f5f40a66ad1cc088e502e7f40ae1806c2 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 22 Sep 2014 07:53:52 +0200
Subject: rules: add rule for naming Dell iDRAC USB Virtual NIC
as 'idrac'
Related: #1523227
---
rules/73-idrac.rules | 6 ++++++
rules/meson.build | 1 +
2 files changed, 7 insertions(+)
create mode 100644 rules/73-idrac.rules
diff --git a/rules/73-idrac.rules b/rules/73-idrac.rules
new file mode 100644
index 0000000..d67fc42
--- /dev/null
+++ b/rules/73-idrac.rules
@@ -0,0 +1,6 @@
+# do not edit this file, it will be overwritten on update
+
+# On Dell PowerEdge systems, the iDRAC7 and later support a USB Virtual NIC
+# with terminates in the iDRAC. Help identify this with 'idrac'
+
+ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb", ATTRS{idVendor}=="413c", ATTRS{idProduct}=="a102", NAME="idrac"
diff --git a/rules/meson.build b/rules/meson.build
index e7e4362..e04a18a 100644
--- a/rules/meson.build
+++ b/rules/meson.build
@@ -17,6 +17,7 @@ rules = files('''
70-joystick.rules
70-mouse.rules
70-touchpad.rules
+ 73-idrac.rules
75-net-description.rules
75-probe_mtd.rules
78-sound-card.rules
--
1.8.3.1

View File

@ -0,0 +1,27 @@
From 16d1f6e5122038fa24392e166a0a88c6cab41dd0 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Tue, 26 Feb 2019 15:22:38 +0100
Subject: [PATCH] rules: add the rule that adds elevator= kernel
command line parameter
Resolves: #1670126
---
rules/meson.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/rules/meson.build b/rules/meson.build
index 1da958b..043313a 100644
--- a/rules/meson.build
+++ b/rules/meson.build
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1+
rules = files('''
+ 40-elevator.rules
60-block.rules
60-block-scheduler.rules
60-cdrom_id.rules
--
2.19.1

View File

@ -0,0 +1,31 @@
From 220a60a61a91153fd8e49e58884b9b0b904888f6 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Wed, 31 Oct 2018 12:50:19 +0100
Subject: [PATCH] sd-bus: properly initialize containers
Fixes a SIGSEGV introduced by commit 38a5315a3a6fab745d8c86ff9e486faaf50b28d1.
The same problem doesn't exist upstream, as the container structure
there is initialized using a compound literal, which is zeroed out by
default.
Related: #1635435
---
src/libsystemd/sd-bus/bus-message.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index eb029e4..e0c8338 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -2051,6 +2051,7 @@ _public_ int sd_bus_message_open_container(
.enclosing = type,
.signature = TAKE_PTR(signature),
.array_size = array_size,
+ .peeked_signature = NULL,
.before = before,
.begin = begin,
.need_offsets = need_offsets,
--
2.19.1

View File

@ -0,0 +1,52 @@
From bec31cf5f0037dd049299e8665e03fc74024e357 Mon Sep 17 00:00:00 2001
From: Alin Popa <alin.popa@bmw.de>
Date: Fri, 14 Feb 2020 09:33:43 +0100
Subject: [PATCH] systemd: Fix busctl crash on aarch64 when setting output
table format
The enum used for column names is integer type while table_set_display() is parsing
arguments on size_t alignment which may result in assert in table_set_display() if
the size between types missmatch. This patch cast the enums to size_t.
An alternative solution would be to change the table_set_display() function
arguments to unsigned type.
---
src/busctl/busctl.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c
index 5f3d5dd..b4e133f 100644
--- a/src/busctl/busctl.c
+++ b/src/busctl/busctl.c
@@ -212,9 +212,27 @@ static int list_bus_names(int argc, char **argv, void *userdata) {
return log_error_errno(r, "Failed to set sort column: %m");
if (arg_show_machine)
- r = table_set_display(table, COLUMN_NAME, COLUMN_PID, COLUMN_PROCESS, COLUMN_USER, COLUMN_CONNECTION, COLUMN_UNIT, COLUMN_SESSION, COLUMN_DESCRIPTION, COLUMN_MACHINE, (size_t) -1);
+ r = table_set_display(table, (size_t) COLUMN_NAME,
+ (size_t) COLUMN_PID,
+ (size_t) COLUMN_PROCESS,
+ (size_t) COLUMN_USER,
+ (size_t) COLUMN_CONNECTION,
+ (size_t) COLUMN_UNIT,
+ (size_t) COLUMN_SESSION,
+ (size_t) COLUMN_DESCRIPTION,
+ (size_t) COLUMN_MACHINE,
+ (size_t) -1);
else
- r = table_set_display(table, COLUMN_NAME, COLUMN_PID, COLUMN_PROCESS, COLUMN_USER, COLUMN_CONNECTION, COLUMN_UNIT, COLUMN_SESSION, COLUMN_DESCRIPTION, (size_t) -1);
+ r = table_set_display(table, (size_t) COLUMN_NAME,
+ (size_t) COLUMN_PID,
+ (size_t) COLUMN_PROCESS,
+ (size_t) COLUMN_USER,
+ (size_t) COLUMN_CONNECTION,
+ (size_t) COLUMN_UNIT,
+ (size_t) COLUMN_SESSION,
+ (size_t) COLUMN_DESCRIPTION,
+ (size_t) -1);
+
if (r < 0)
return log_error_errno(r, "Failed to set columns to display: %m");
--
1.8.3.1

View File

@ -16,7 +16,7 @@
Name: systemd Name: systemd
Url: https://www.freedesktop.org/wiki/Software/systemd Url: https://www.freedesktop.org/wiki/Software/systemd
Version: 243 Version: 243
Release: 20 Release: 21
License: MIT and LGPLv2+ and GPLv2+ License: MIT and LGPLv2+ and GPLv2+
Summary: System and Service Manager Summary: System and Service Manager
@ -62,6 +62,29 @@ Patch0015: CVE-2020-1712-5.patch
Patch0016: sd-journal-close-journal-files-that-were-deleted-by-.patch Patch0016: sd-journal-close-journal-files-that-were-deleted-by-.patch
Patch0017: pid1-bump-DefaultTasksMax-to-80-of-the-kernel-pid.ma.patch Patch0017: pid1-bump-DefaultTasksMax-to-80-of-the-kernel-pid.ma.patch
Patch0018: fix-two-VF-virtual-machines-have-same-mac-address.patch Patch0018: fix-two-VF-virtual-machines-have-same-mac-address.patch
Patch0019: logind-set-RemoveIPC-to-false-by-default.patch
Patch0020: rules-add-rule-for-naming-Dell-iDRAC-USB-Virtual-NIC.patch
Patch0021: unit-don-t-add-Requires-for-tmp.mount.patch
Patch0022: Revert-sysctl.d-switch-net.ipv4.conf.all.rp_filter-f.patch
Patch2023: rules-add-elevator-kernel-command-line-parameter.patch
Patch2024: rules-add-the-rule-that-adds-elevator-kernel-command.patch
Patch2025: units-add-Install-section-to-tmp.mount.patch
Patch0026: Make-systemd-udevd.service-start-after-systemd-remou.patch
Patch0027: udev-virsh-shutdown-vm.patch
Patch0028: fix-fd-leak-in-no-memory-condition.patch
Patch0029: dbus-execute-avoid-extra-strdup.patch
Patch0030: Avoid-tmp-being-mounted-as-tmpfs-without-the-user-s-.patch
Patch0031: sd-bus-properly-initialize-containers.patch
Patch0032: Revert-core-one-step-back-again-for-nspawn-we-actual.patch
Patch0033: journal-don-t-enable-systemd-journald-audit.socket-b.patch
# The patch of 0026~0029 resolve the pid1 memory leaks
Patch0034: revert-pid1-drop-unit-caches-only-based-on-mtime.patch
Patch0035: revert-analyze-add-unit-files-to-dump-the-unit-fragm.patch
Patch0036: revert-pid1-use-a-cache-for-all-unit-aliases.patch
Patch0037: revert-shared-unit-file-add-a-function-to-validate-u.patch
Patch0038: systemd-Fix-busctl-crash-on-aarch64-when-setting-out.patch
#openEuler #openEuler
Patch9002: 1509-fix-journal-file-descriptors-leak-problems.patch Patch9002: 1509-fix-journal-file-descriptors-leak-problems.patch
@ -90,7 +113,6 @@ BuildRequires: python3-devel, python3-lxml, firewalld-filesystem, libseccomp-de
BuildRequires: gnu-efi gnu-efi-devel BuildRequires: gnu-efi gnu-efi-devel
BuildRequires: valgrind-devel, util-linux BuildRequires: valgrind-devel, util-linux
Requires: %{name}-libs = %{version}-%{release}
Requires(post): coreutils Requires(post): coreutils
Requires(post): sed Requires(post): sed
Requires(post): acl Requires(post): acl
@ -111,8 +133,22 @@ Obsoletes: systemd-sysv < 206
Obsoletes: %{name} < 229-5 Obsoletes: %{name} < 229-5
Provides: systemd-sysv = 206 Provides: systemd-sysv = 206
Conflicts: initscripts < 9.56.1 Conflicts: initscripts < 9.56.1
Conflicts: fedora-release < 23-0.12
Recommends: %{name}-help Recommends: %{name}-help
#libs
Obsoletes: libudev < 183
Obsoletes: systemd < 185-4
Conflicts: systemd < 185-4
Obsoletes: systemd-compat-libs < 230
Obsoletes: nss-myhostname < 0.4
Provides: nss-myhostname = 0.4
Provides: nss-myhostname%{_isa} = 0.4
Requires(post): coreutils
Requires(post): sed
Requires(post): grep
Requires(post): /usr/bin/getent
Provides: %{name}-pam Provides: %{name}-pam
Provides: %{name}-rpm-config Provides: %{name}-rpm-config
Obsoletes: %{name}-pam Obsoletes: %{name}-pam
@ -1340,6 +1376,8 @@ fi
%{_udevhwdbdir}/60-sensor.hwdb %{_udevhwdbdir}/60-sensor.hwdb
%{_udevhwdbdir}/70-mouse.hwdb %{_udevhwdbdir}/70-mouse.hwdb
%{_udevrulesdir}/40-openEuler.rules %{_udevrulesdir}/40-openEuler.rules
%{_udevrulesdir}/40-elevator.rules
%{_udevrulesdir}/73-idrac.rules
%{_udevrulesdir}/60-block.rules %{_udevrulesdir}/60-block.rules
%{_udevrulesdir}/60-input-id.rules %{_udevrulesdir}/60-input-id.rules
%{_udevrulesdir}/71-seat.rules %{_udevrulesdir}/71-seat.rules
@ -1452,6 +1490,12 @@ fi
%exclude /usr/share/man/man3/* %exclude /usr/share/man/man3/*
%changelog %changelog
* Mon Apr 27 2020 openEuler Buildteam <buildteam@openeuler.org> - 243-21
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:resolve memleak of pid1 and add some patches
* Thu Apr 9 2020 openEuler Buildteam <buildteam@openeuler.org> - 243-20 * Thu Apr 9 2020 openEuler Buildteam <buildteam@openeuler.org> - 243-20
- Type:enhancement - Type:enhancement
- ID:NA - ID:NA

View File

@ -0,0 +1,23 @@
From 3d5e0620b4a3298620c8d985cec42772c7f77c6d Mon Sep 17 00:00:00 2001
From: openEuler Buildteam <buildteam@openeuler.org>
Date: Thu, 31 Jan 2019 02:24:16 -0500
Subject: [PATCH] systemd:virsh shutdown vm
---
src/login/70-power-switch.rules | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/login/70-power-switch.rules b/src/login/70-power-switch.rules
index d69e65b..cb77f7a 100644
--- a/src/login/70-power-switch.rules
+++ b/src/login/70-power-switch.rules
@@ -11,5 +11,6 @@ ACTION=="remove", GOTO="power_switch_end"
SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT_SWITCH}=="1", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT_KEY}=="1", TAG+="power-switch"
+SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="platform", ATTRS{keys}=="116", TAG+="power-switch"
LABEL="power_switch_end"
--
1.8.3.1

View File

@ -0,0 +1,27 @@
From 03e52d33bbdea731eaa79545bb1d30c5b21abe3d Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Mon, 5 Sep 2016 12:47:09 +0200
Subject: [PATCH] unit: don't add Requires for tmp.mount
Resolves: #1619292
---
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 c9f756c..721d8d6 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1421,7 +1421,7 @@ static int unit_add_mount_dependencies(Unit *u) {
if (r < 0)
return r;
- if (m->fragment_path) {
+ if (m->fragment_path && !streq(m->id, "tmp.mount")) {
r = unit_add_dependency(u, UNIT_REQUIRES, m, true, di.origin_mask);
if (r < 0)
return r;
--
1.8.3.1

View File

@ -0,0 +1,25 @@
From bb3d205bea1c83cbd0e27b504f5f1faa884fb602 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Tue, 22 Jan 2019 10:28:42 +0100
Subject: [PATCH] units: add [Install] section to tmp.mount
Resolves: #1667065
---
units/tmp.mount | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/units/tmp.mount b/units/tmp.mount
index 742d863..b558047 100644
--- a/units/tmp.mount
+++ b/units/tmp.mount
@@ -22,3 +22,7 @@ What=tmpfs
Where=/tmp
Type=tmpfs
Options=mode=1777,strictatime,nosuid,nodev
+
+# Make 'systemctl enable tmp.mount' work:
+[Install]
+WantedBy=local-fs.target
--
1.8.3.1