From 28da91939e63cd38be07377f108ff6e89e59062d4bf15d35a7412ece08631a12 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Fri, 20 Dec 2013 12:23:11 +0000 Subject: [PATCH] . OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=480 --- 1011-check-4-valid-kmsg-device.patch | 72 +++++++++---------- ...XDG_RUNTIME_DIR_of_the_original_user.patch | 4 +- systemd-mini.spec | 3 + systemd.changes | 11 +++ 4 files changed, 48 insertions(+), 42 deletions(-) diff --git a/1011-check-4-valid-kmsg-device.patch b/1011-check-4-valid-kmsg-device.patch index ffb36937..6d57c357 100644 --- a/1011-check-4-valid-kmsg-device.patch +++ b/1011-check-4-valid-kmsg-device.patch @@ -6,65 +6,57 @@ Avoid a busy systemd-journald due polling a broken /dec/kmsg in lxc environments. --- - journald-kmsg.c | 27 ++++++++++++++++++++++++++- - 1 file changed, 26 insertions(+), 1 deletion(-) + journald-kmsg.c | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) Index: systemd-208/src/journal/journald-kmsg.c =================================================================== --- systemd-208/src/journal/journald-kmsg.c -+++ systemd-208/src/journal/journald-kmsg.c 2013-11-21 13:30:22.930735683 +0000 -@@ -23,7 +23,9 @@ - #include - #include - #include -+#include - #include -+#include - - #include - #include -@@ -377,20 +379,43 @@ int server_flush_dev_kmsg(Server *s) { ++++ systemd-208/src/journal/journald-kmsg.c 2013-12-20 11:34:39.762236175 +0000 +@@ -377,15 +377,18 @@ int server_flush_dev_kmsg(Server *s) { int server_open_dev_kmsg(Server *s) { struct epoll_event ev; -+ struct stat st; ++ int r; assert(s); s->dev_kmsg_fd = open("/dev/kmsg", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY); if (s->dev_kmsg_fd < 0) { - log_warning("Failed to open /dev/kmsg, ignoring: %m"); -+ /* Do not warn as it may not exists in LXC environments */ -+ if (errno != ENOENT) -+ log_warning("Failed to open /dev/kmsg, ignoring: %m"); ++ log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, ++ "Failed to open /dev/kmsg, ignoring: %m"); return 0; } -+ if (fstat(s->dev_kmsg_fd, &st) < 0) { -+ log_error("Failed to stat /dev/kmsg fd, ignoring: %m"); -+ close_nointr_nofail(s->dev_kmsg_fd); -+ s->dev_kmsg_fd = -1; -+ return 0; -+ } -+ -+ if (!S_ISCHR(st.st_mode) || major(st.st_rdev) != 1 || minor(st.st_rdev) != 11) { -+ int old_errno = errno; -+ errno = ENODEV; -+ log_warning("Irregular device /dev/kmsg, ignoring: %m"); -+ errno = old_errno; -+ close_nointr_nofail(s->dev_kmsg_fd); -+ s->dev_kmsg_fd = -1; -+ return 0; -+ } -+ ++ r = 0; zero(ev); ev.events = EPOLLIN; ev.data.fd = s->dev_kmsg_fd; - if (epoll_ctl(s->epoll_fd, EPOLL_CTL_ADD, s->dev_kmsg_fd, &ev) < 0) { - -+ close_nointr_nofail(s->dev_kmsg_fd); -+ s->dev_kmsg_fd = -1; -+ +@@ -394,15 +397,24 @@ int server_open_dev_kmsg(Server *s) { /* This will fail with EPERM on older kernels where * /dev/kmsg is not readable. */ if (errno == EPERM) +- return 0; ++ goto fail; + + log_error("Failed to add /dev/kmsg fd to epoll object: %m"); +- return -errno; ++ r = -errno; ++ goto fail; + } + + s->dev_kmsg_readable = true; + + return 0; ++ ++fail: ++ if (s->dev_kmsg_fd >= 0) { ++ close_nointr_nofail(s->dev_kmsg_fd); ++ s->dev_kmsg_fd = -1; ++ } ++ ++ return r; + } + + int server_open_kernel_seqnum(Server *s) { diff --git a/1012-pam_systemd_do_override_XDG_RUNTIME_DIR_of_the_original_user.patch b/1012-pam_systemd_do_override_XDG_RUNTIME_DIR_of_the_original_user.patch index 59d166ae..bdf9383b 100644 --- a/1012-pam_systemd_do_override_XDG_RUNTIME_DIR_of_the_original_user.patch +++ b/1012-pam_systemd_do_override_XDG_RUNTIME_DIR_of_the_original_user.patch @@ -157,12 +157,12 @@ Based on upstream baae0358f349870544884e405e82e4be7d8add9f + pam_syslog(handle, LOG_ERR, "Failed to set runtime dir."); + goto finish; + } -+ } else { -+ (void) unsetenv("XDG_RUNTIME_DIR"); ++ } else if (getenv("XDG_RUNTIME_DIR")) { + r = pam_putenv(handle, "XDG_RUNTIME_DIR"); + if (r != PAM_SUCCESS && r != PAM_BAD_ITEM) { + pam_syslog(handle, LOG_ERR, "Failed to unset runtime dir."); + } ++ (void) unsetenv("XDG_RUNTIME_DIR"); } if (!isempty(seat)) { diff --git a/systemd-mini.spec b/systemd-mini.spec index 8f21effa..cdf81be0 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -588,6 +588,9 @@ export V=1 --with-debug-shell=/bin/bash \ --disable-smack \ --disable-ima \ +%if 0%{?suse_version} > 1310 + --disable-multi-seat-x \ +%endif CFLAGS="%{optflags}" make %{?_smp_mflags} diff --git a/systemd.changes b/systemd.changes index 68a5b3b5..a9766b37 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Fri Dec 20 12:06:18 UTC 2013 - werner@suse.de + +- Adapt patch + 1011-check-4-valid-kmsg-device.patch + to fit current upstream version maybe related to bnc#854884 +- Change patch + 1012-pam_systemd_do_override_XDG_RUNTIME_DIR_of_the_original_user.patch + to check if XDG_RUNTIME_DIR is set before the call of pam_putenv() + may fix bnc#855160 + ------------------------------------------------------------------- Fri Dec 20 09:40:01 UTC 2013 - lbsousajr@gmail.com