[systemd-commits] 2 commits - src/core src/libsystemd

David Herrmann dvdhrm at kemper.freedesktop.org
Sun Jan 18 14:58:01 PST 2015


 src/core/manager.c                 |    2 +-
 src/libsystemd/sd-bus/bus-kernel.c |   27 +++++++++------------------
 2 files changed, 10 insertions(+), 19 deletions(-)

New commits:
commit 314808cea4d7655b881ce7b1204efa476e7b8fbb
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Sun Jan 18 23:56:19 2015 +0100

    bus: drop systemd.kdbus_attach_flags_mask= cmdline
    
    There is no reason to provide our own attach_flags_mask. We can simply
    rely on kdbus.attach_flags_mask= which is read by the kernel *and* kmod.
    If it's set, we assume the user wants to override our setting, so we
    simply skip setting it.

diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index bd82945..e73a507 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -1741,30 +1741,21 @@ int bus_kernel_fix_attach_mask(void) {
 
         /* By default we don't want any kdbus metadata fields to be
          * suppressed, hence we reset the kernel mask for it to
-         * (uint64_t) -1. This is overridable via a kernel command
-         * line option, however. */
+         * (uint64_t) -1. If the module argument was overwritten by
+         * the kernel cmdline, we leave it as is. */
 
-        r = get_proc_cmdline_key("systemd.kdbus_attach_flags_mask=", &mask);
+        r = get_proc_cmdline_key("kdbus.attach_flags_mask=", &mask);
         if (r < 0)
                 return log_warning_errno(r, "Failed to read kernel command line: %m");
 
-        if (mask) {
-                const char *p = mask;
-
-                if (startswith(p, "0x"))
-                        p += 2;
-
-                if (sscanf(p, "%" PRIx64, &m) != 1)
-                        log_warning("Couldn't parse systemd.kdbus_attach_flags_mask= kernel command line parameter.");
+        if (r == 0) {
+                sprintf(buf, "0x%" PRIx64 "\n", m);
+                r = write_string_file("/sys/module/kdbus/parameters/attach_flags_mask", buf);
+                if (r < 0)
+                        return log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+                                              "Failed to write kdbus attach mask: %m");
         }
 
-        sprintf(buf, "0x%" PRIx64 "\n", m);
-        r = write_string_file("/sys/module/kdbus/parameters/attach_flags_mask", buf);
-        if (r < 0)
-                return log_full_errno(
-                                IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
-                                "Failed to write kdbus attach mask: %m");
-
         return 0;
 }
 

commit 90b99192ad5b7674585996e2b801679989f8a8a7
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Sun Jan 18 23:54:42 2015 +0100

    core: write kdbus.attach_flags_mask only on real boot
    
    The kernel module system is not namespaced, so no container should ever
    modify global options. Make sure we set the kdbus attach_flags_mask only
    on a real boot as PID1.

diff --git a/src/core/manager.c b/src/core/manager.c
index e53f222..64ff464 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -708,7 +708,7 @@ static int manager_setup_kdbus(Manager *m) {
         if (m->test_run || m->kdbus_fd >= 0)
                 return 0;
 
-        if (getpid() == 1)
+        if (m->running_as == SYSTEMD_SYSTEM && detect_container(NULL) <= 0)
                 bus_kernel_fix_attach_mask();
 
         m->kdbus_fd = bus_kernel_create_bus(



More information about the systemd-commits mailing list