Commit 617ee70c authored by Felipe Sateler's avatar Felipe Sateler

udev: Backport upstream preventing mass killings when not running under systemd

Closes: #918764
parent 8473f88f
......@@ -42,6 +42,7 @@ meson-stop-setting-fPIE-globally.patch
Revert-Always-rename-an-interface-to-its-name-specified-i.patch
process-util-don-t-use-overly-large-buffer-to-store-proce.patch
udevadm-fix-segfault.patch
udev-check-whether-systemd-is-running-and-do-not-use-cg_k.patch
debian/Use-Debian-specific-config-files.patch
debian/Bring-tmpfiles.d-tmp.conf-in-line-with-Debian-defaul.patch
debian/Make-run-lock-tmpfs-an-API-fs.patch
......
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 6 Feb 2019 19:34:13 +0100
Subject: udev: check whether systemd is running,
and do not use cg_kill() if not
Fixes #11645.
(cherry picked from commit 31cbd2025359e1e8435a2dc371e439591846d8c4)
---
src/udev/udevd.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index a1050a7..7302b06 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1799,10 +1799,10 @@ static int run(int argc, char *argv[]) {
dev_setup(NULL, UID_INVALID, GID_INVALID);
- if (getppid() == 1) {
- /* get our own cgroup, we regularly kill everything udev has left behind
- we only do this on systemd systems, and only if we are directly spawned
- by PID1. otherwise we are not guaranteed to have a dedicated cgroup */
+ if (getppid() == 1 && sd_booted() > 0) {
+ /* Get our own cgroup, we regularly kill everything udev has left behind.
+ * We only do this on systemd systems, and only if we are directly spawned
+ * by PID1. Otherwise we are not guaranteed to have a dedicated cgroup. */
r = cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, 0, &cgroup);
if (r < 0) {
if (IN_SET(r, -ENOENT, -ENOMEDIUM))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment