Skip to contentSkip to conversation

systemd: fixs mips64 login issue

PATCH In review Armin Kuster 5 participants 6 messages Nov 23, 2017 – Nov 28, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 systemd: fixs mips64 login issue

From: Armin Kuster <[email protected]>

With out this patch, one can not login to a mips64 machine like qumumips64 or Octeon mips64 when systemd is enabled.

remove PACKAGECONFIG option too

affects: systemd < 2.3.2

---
 .../systemd/Ensure-kdbus-isn-t-used-3501.patch     | 670 +++++++++++++++++++++
 meta/recipes-core/systemd/systemd_230.bb           |   3 +-
 2 files changed, 671 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t-used-3501.patch
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t-used-3501.patch new file +670 -0
new file mode 100644
index 0000000..d08a10f
@@ -0,0 +1,670 @@
+From 222953e87f34545a3f9c6d3c18216e222bf6ea94 Mon Sep 17 00:00:00 2001
+From: Dave Reisner <[email protected]>
+Date: Fri, 10 Jun 2016 09:50:16 -0400
+Subject: [PATCH] Ensure kdbus isn't used (#3501)
+
+Delete the dbus1 generator and some critical wiring. This prevents
+kdbus from being loaded or detected. As such, it will never be used,
+even if the user still has a useful kdbus module loaded on their system.
+
+Sort of fixes #3480. Not really, but it's better than the current state.
+
+Upstream-Status: Backport
+Signed-off-by: Armin Kuster <[email protected]>
+
+---
+ Makefile.am                           |  20 --
+ autogen.sh                            |  12 +-
+ configure.ac                          |  10 -
+ src/core/busname.c                    |   7 +-
+ src/core/kmod-setup.c                 |   3 -
+ src/core/manager.c                    |  23 ---
+ src/core/mount-setup.c                |   2 -
+ src/core/service.c                    |  17 +-
+ src/dbus1-generator/dbus1-generator.c | 331 ----------------------------------
+ src/login/pam_systemd.c               |  31 ++--
+ src/shared/bus-util.c                 |  34 ----
+ src/shared/bus-util.h                 |   3 -
+ 12 files changed, 23 insertions(+), 470 deletions(-)
+ delete mode 100644 src/dbus1-generator/dbus1-generator.c
+
+Index: git/autogen.sh
+===================================================================
+--- git.orig/autogen.sh
++++ git/autogen.sh
+@@ -55,19 +55,19 @@ fi
+ cd $oldpwd
+ 
+ if [ "x$1" = "xc" ]; then
+-        $topdir/configure CFLAGS='-g -O0 -ftrapv' --enable-kdbus $args
++        $topdir/configure CFLAGS='-g -O0 -ftrapv' $args
+         make clean
+ elif [ "x$1" = "xg" ]; then
+-        $topdir/configure CFLAGS='-g -Og -ftrapv' --enable-kdbus $args
++        $topdir/configure CFLAGS='-g -Og -ftrapv' $args
+         make clean
+ elif [ "x$1" = "xa" ]; then
+-        $topdir/configure CFLAGS='-g -O0 -Wsuggest-attribute=pure -Wsuggest-attribute=const -ftrapv' --enable-kdbus $args
++        $topdir/configure CFLAGS='-g -O0 -Wsuggest-attribute=pure -Wsuggest-attribute=const -ftrapv' $args
+         make clean
+ elif [ "x$1" = "xl" ]; then
+-        $topdir/configure CC=clang CFLAGS='-g -O0 -ftrapv' --enable-kdbus $args
++        $topdir/configure CC=clang CFLAGS='-g -O0 -ftrapv' $args
+         make clean
+ elif [ "x$1" = "xs" ]; then
+-        scan-build $topdir/configure CFLAGS='-std=gnu99 -g -O0 -ftrapv' --enable-kdbus $args
++        scan-build $topdir/configure CFLAGS='-std=gnu99 -g -O0 -ftrapv' $args
+         scan-build make
+ else
+         echo
+@@ -75,6 +75,6 @@ else
+         echo "Initialized build system. For a common configuration please run:"
+         echo "----------------------------------------------------------------"
+         echo
+-        echo "$topdir/configure CFLAGS='-g -O0 -ftrapv' --enable-kdbus $args"
++        echo "$topdir/configure CFLAGS='-g -O0 -ftrapv' $args"
+         echo
+ fi
+Index: git/configure.ac
+===================================================================
+--- git.orig/configure.ac
++++ git/configure.ac
+@@ -1294,16 +1294,6 @@ AC_ARG_WITH(tpm-pcrindex,
+ AC_DEFINE_UNQUOTED(SD_TPM_PCR, [$SD_TPM_PCR], [TPM PCR register number to use])
+ 
+ # ------------------------------------------------------------------------------
+-have_kdbus=no
+-AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--disable-kdbus], [do not connect to kdbus by default]))
+-if test "x$enable_kdbus" != "xno"; then
+-        AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus is to be connected to by default])
+-        have_kdbus=yes
+-        M4_DEFINES="$M4_DEFINES -DENABLE_KDBUS"
+-fi
+-AM_CONDITIONAL(ENABLE_KDBUS, [test "$have_kdbus" = "yes"])
+-
+-# ------------------------------------------------------------------------------
+ AC_ARG_WITH(rc-local-script-path-start,
+         AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
+                 [Path to /etc/rc.local]),
+Index: git/src/core/busname.c
+===================================================================
+--- git.orig/src/core/busname.c
++++ git/src/core/busname.c
+@@ -998,12 +998,7 @@ static int busname_get_timeout(Unit *u,
+ }
+ 
+ static bool busname_supported(void) {
+-        static int supported = -1;
+-
+-        if (supported < 0)
+-                supported = is_kdbus_available();
+-
+-        return supported;
++        return false;
+ }
+ 
+ static int busname_control_pid(Unit *u) {
+Index: git/src/core/kmod-setup.c
+===================================================================
+--- git.orig/src/core/kmod-setup.c
++++ git/src/core/kmod-setup.c
+@@ -64,9 +64,6 @@ int kmod_setup(void) {
+                 /* this should never be a module */
+                 { "unix",      "/proc/net/unix",            true,   true,    NULL      },
+ 
+-                /* IPC is needed before we bring up any other services */
+-                { "kdbus",     "/sys/fs/kdbus",             false,  false,   is_kdbus_wanted },
+-
+ #ifdef HAVE_LIBIPTC
+                 /* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */
+                 { "ip_tables", "/proc/net/ip_tables_names", false,  false,   NULL      },
+Index: git/src/core/manager.c
+===================================================================
+--- git.orig/src/core/manager.c
++++ git/src/core/manager.c
+@@ -809,28 +809,6 @@ static int manager_setup_cgroups_agent(M
+         return 0;
+ }
+ 
+-static int manager_setup_kdbus(Manager *m) {
+-        _cleanup_free_ char *p = NULL;
+-
+-        assert(m);
+-
+-        if (m->test_run || m->kdbus_fd >= 0)
+-                return 0;
+-        if (!is_kdbus_available())
+-                return -ESOCKTNOSUPPORT;
+-
+-        m->kdbus_fd = bus_kernel_create_bus(
+-                        MANAGER_IS_SYSTEM(m) ? "system" : "user",
+-                        MANAGER_IS_SYSTEM(m), &p);
+-
+-        if (m->kdbus_fd < 0)
+-                return log_debug_errno(m->kdbus_fd, "Failed to set up kdbus: %m");
+-
+-        log_debug("Successfully set up kdbus on %s", p);
+-
+-        return 0;
+-}
+-
+ static int manager_connect_bus(Manager *m, bool reexecuting) {
+         bool try_bus_connect;
+ 
+@@ -1225,7 +1203,6 @@ int manager_startup(Manager *m, FILE *se
+ 
+         /* We might have deserialized the kdbus control fd, but if we
+          * didn't, then let's create the bus now. */
+-        manager_setup_kdbus(m);
+         manager_connect_bus(m, !!serialization);
+         bus_track_coldplug(m, &m->subscribed, &m->deserialized_subscribed);
+ 
+Index: git/src/core/mount-setup.c
+===================================================================
+--- git.orig/src/core/mount-setup.c
++++ git/src/core/mount-setup.c
+@@ -108,8 +108,6 @@ static const MountPoint mount_table[] =
+         { "efivarfs",    "/sys/firmware/efi/efivars", "efivarfs",   NULL,                      MS_NOSUID|MS_NOEXEC|MS_NODEV,
+           is_efi_boot,   MNT_NONE                   },
+ #endif
+-        { "kdbusfs",    "/sys/fs/kdbus",             "kdbusfs",    NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
+-          is_kdbus_wanted,       MNT_IN_CONTAINER },
+ };
+ 
+ /* These are API file systems that might be mounted by other software,
+Index: git/src/core/service.c
+===================================================================
+--- git.orig/src/core/service.c
++++ git/src/core/service.c
+@@ -574,20 +574,9 @@ static int service_setup_bus_name(Servic
+         if (!s->bus_name)
+                 return 0;
+ 
+-        if (is_kdbus_available()) {
+-                const char *n;
+-
+-                n = strjoina(s->bus_name, ".busname");
+-                r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, n, NULL, true);
+-                if (r < 0)
+-                        return log_unit_error_errno(UNIT(s), r, "Failed to add dependency to .busname unit: %m");
+-
+-        } else {
+-                /* If kdbus is not available, we know the dbus socket is required, hence pull it in, and require it */
+-                r = unit_add_dependency_by_name(UNIT(s), UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, NULL, true);
+-                if (r < 0)
+-                        return log_unit_error_errno(UNIT(s), r, "Failed to add dependency on " SPECIAL_DBUS_SOCKET ": %m");
+-        }
++        r = unit_add_dependency_by_name(UNIT(s), UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, NULL, true);
++        if (r < 0)
++                return log_unit_error_errno(UNIT(s), r, "Failed to add dependency on " SPECIAL_DBUS_SOCKET ": %m");
+ 
+         /* Regardless if kdbus is used or not, we always want to be ordered against dbus.socket if both are in the transaction. */
+         r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, SPECIAL_DBUS_SOCKET, NULL, true);
+Index: git/src/dbus1-generator/dbus1-generator.c
+===================================================================
+--- git.orig/src/dbus1-generator/dbus1-generator.c
++++ /dev/null
+@@ -1,331 +0,0 @@
+-/***
+-  This file is part of systemd.
+-
+-  Copyright 2013 Lennart Poettering
+-
+-  systemd is free software; you can redistribute it and/or modify it
+-  under the terms of the GNU Lesser General Public License as published by
+-  the Free Software Foundation; either version 2.1 of the License, or
+-  (at your option) any later version.
+-
+-  systemd is distributed in the hope that it will be useful, but
+-  WITHOUT ANY WARRANTY; without even the implied warranty of
+-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-  Lesser General Public License for more details.
+-
+-  You should have received a copy of the GNU Lesser General Public License
+-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-***/
+-
+-#include "alloc-util.h"
+-#include "bus-internal.h"
+-#include "bus-util.h"
+-#include "cgroup-util.h"
+-#include "conf-parser.h"
+-#include "dirent-util.h"
+-#include "fd-util.h"
+-#include "fileio.h"
+-#include "mkdir.h"
+-#include "special.h"
+-#include "unit-name.h"
+-#include "util.h"
+-
+-static const char *arg_dest_late = "/tmp", *arg_dest = "/tmp";
+-
+-static int create_dbus_files(
+-                const char *path,
+-                const char *name,
+-                const char *service,
+-                const char *exec,
+-                const char *user,
+-                const char *type) {
+-
+-        _cleanup_free_ char *b = NULL, *s = NULL, *lnk = NULL;
+-        _cleanup_fclose_ FILE *f = NULL;
+-        int r;
+-
+-        assert(path);
+-        assert(name);
+-        assert(service || exec);
+-
+-        if (!service) {
+-                _cleanup_free_ char *a = NULL;
+-
+-                s = strjoin("dbus-", name, ".service", NULL);
+-                if (!s)
+-                        return log_oom();
+-
+-                a = strjoin(arg_dest_late, "/", s, NULL);
+-                if (!a)
+-                        return log_oom();
+-
+-                f = fopen(a, "wxe");
+-                if (!f)
+-                        return log_error_errno(errno, "Failed to create %s: %m", a);
+-
+-                fprintf(f,
+-                        "# Automatically generated by systemd-dbus1-generator\n\n"
+-                        "[Unit]\n"
+-                        "SourcePath=%s\n"
+-                        "Description=DBUS1: %s\n"
+-                        "Documentation=man:systemd-dbus1-generator(8)\n\n"
+-                        "[Service]\n"
+-                        "ExecStart=%s\n"
+-                        "Type=dbus\n"
+-                        "BusName=%s\n",
+-                        path,
+-                        name,
+-                        exec,
+-                        name);
+-
+-                if (user)
+-                        fprintf(f, "User=%s\n", user);
+-
+-
+-                if (type) {
+-                        fprintf(f, "Environment=DBUS_STARTER_BUS_TYPE=%s\n", type);
+-
+-                        if (streq(type, "system"))
+-                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS=" DEFAULT_SYSTEM_BUS_ADDRESS "\n");
+-                        else if (streq(type, "session")) {
+-                                char *run;
+-
+-                                run = getenv("XDG_RUNTIME_DIR");
+-                                if (!run) {
+-                                        log_error("XDG_RUNTIME_DIR not set.");
+-                                        return -EINVAL;
+-                                }
+-
+-                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS="KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT "\n",
+-                                        getuid(), run);
+-                        }
+-                }
+-
+-                r = fflush_and_check(f);
+-                if (r < 0)
+-                        return log_error_errno(r, "Failed to write %s: %m", a);
+-
+-                f = safe_fclose(f);
+-
+-                service = s;
+-        }
+-
+-        b = strjoin(arg_dest_late, "/", name, ".busname", NULL);
+-        if (!b)
+-                return log_oom();
+-
+-        f = fopen(b, "wxe");
+-        if (!f)
+-                return log_error_errno(errno, "Failed to create %s: %m", b);
+-
+-        fprintf(f,
+-                "# Automatically generated by systemd-dbus1-generator\n\n"
+-                "[Unit]\n"
+-                "SourcePath=%s\n"
+-                "Description=DBUS1: %s\n"
+-                "Documentation=man:systemd-dbus1-generator(8)\n\n"
+-                "[BusName]\n"
+-                "Name=%s\n"
+-                "Service=%s\n"
+-                "AllowWorld=talk\n",
+-                path,
+-                name,
+-                name,
+-                service);
+-
+-        r = fflush_and_check(f);
+-        if (r < 0)
+-                return log_error_errno(r, "Failed to write %s: %m", b);
+-
+-        lnk = strjoin(arg_dest_late, "/" SPECIAL_BUSNAMES_TARGET ".wants/", name, ".busname", NULL);
+-        if (!lnk)
+-                return log_oom();
+-
+-        mkdir_parents_label(lnk, 0755);
+-        if (symlink(b, lnk))
+-                return log_error_errno(errno, "Failed to create symlink %s: %m", lnk);
+-
+-        return 0;
+-}
+-
+-static int add_dbus(const char *path, const char *fname, const char *type) {
+-        _cleanup_free_ char *name = NULL, *exec = NULL, *user = NULL, *service = NULL;
+-
+-        const ConfigTableItem table[] = {
+-                { "D-BUS Service", "Name", config_parse_string, 0, &name },
+-                { "D-BUS Service", "Exec", config_parse_string, 0, &exec },
+-                { "D-BUS Service", "User", config_parse_string, 0, &user },
+-                { "D-BUS Service", "SystemdService", config_parse_string, 0, &service },
+-                { },
+-        };
+-
+-        char *p;
+-        int r;
+-
+-        assert(path);
+-        assert(fname);
+-
+-        p = strjoina(path, "/", fname);
+-        r = config_parse(NULL, p, NULL,
+-                         "D-BUS Service\0",
+-                         config_item_table_lookup, table,
+-                         true, false, true, NULL);
+-        if (r < 0)
+-                return r;
+-
+-        if (!name) {
+-                log_warning("Activation file %s lacks name setting, ignoring.", p);
+-                return 0;
+-        }
+-
+-        if (!service_name_is_valid(name)) {
+-                log_warning("Bus service name %s is not valid, ignoring.", name);
+-                return 0;
+-        }
+-
+-        if (streq(name, "org.freedesktop.systemd1")) {
+-                log_debug("Skipping %s, identified as systemd.", p);
+-                return 0;
+-        }
+-
+-        if (service) {
+-                if (!unit_name_is_valid(service, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE)) {
+-                        log_warning("Unit name %s is not valid, ignoring.", service);
+-                        return 0;
+-                }
+-                if (!endswith(service, ".service")) {
+-                        log_warning("Bus names can only activate services, ignoring %s.", p);
+-                        return 0;
+-                }
+-        } else {
+-                if (streq(exec, "/bin/false") || !exec) {
+-                        log_warning("Neither service name nor binary path specified, ignoring %s.", p);
+-                        return 0;
+-                }
+-
+-                if (exec[0] != '/') {
+-                        log_warning("Exec= in %s does not start with an absolute path, ignoring.", p);
+-                        return 0;
+-                }
+-        }
+-
+-        return create_dbus_files(p, name, service, exec, user, type);
+-}
+-
+-static int parse_dbus_fragments(const char *path, const char *type) {
+-        _cleanup_closedir_ DIR *d = NULL;
+-        struct dirent *de;
+-        int r;
+-
+-        assert(path);
+-        assert(type);
+-
+-        d = opendir(path);
+-        if (!d) {
+-                if (errno == -ENOENT)
+-                        return 0;
+-
+-                return log_error_errno(errno, "Failed to enumerate D-Bus activated services: %m");
+-        }
+-
+-        r = 0;
+-        FOREACH_DIRENT(de, d, goto fail) {
+-                int q;
+-
+-                if (!endswith(de->d_name, ".service"))
+-                        continue;
+-
+-                q = add_dbus(path, de->d_name, type);
+-                if (q < 0)
+-                        r = q;
+-        }
+-
+-        return r;
+-
+-fail:
+-        return log_error_errno(errno, "Failed to read D-Bus services directory: %m");
+-}
+-
+-static int link_busnames_target(const char *units) {
+-        const char *f, *t;
+-
+-        f = strjoina(units, "/" SPECIAL_BUSNAMES_TARGET);
+-        t = strjoina(arg_dest, "/" SPECIAL_BASIC_TARGET ".wants/" SPECIAL_BUSNAMES_TARGET);
+-
+-        mkdir_parents_label(t, 0755);
+-        if (symlink(f, t) < 0)
+-                return log_error_errno(errno, "Failed to create symlink %s: %m", t);
+-
+-        return 0;
+-}
+-
+-static int link_compatibility(const char *units) {
+-        const char *f, *t;
+-
+-        f = strjoina(units, "/systemd-bus-proxyd.socket");
+-        t = strjoina(arg_dest, "/" SPECIAL_DBUS_SOCKET);
+-        mkdir_parents_label(t, 0755);
+-        if (symlink(f, t) < 0)
+-                return log_error_errno(errno, "Failed to create symlink %s: %m", t);
+-
+-        f = strjoina(units, "/systemd-bus-proxyd.socket");
+-        t = strjoina(arg_dest, "/" SPECIAL_SOCKETS_TARGET ".wants/systemd-bus-proxyd.socket");
+-        mkdir_parents_label(t, 0755);
+-        if (symlink(f, t) < 0)
+-                return log_error_errno(errno, "Failed to create symlink %s: %m", t);
+-
+-        t = strjoina(arg_dest, "/" SPECIAL_DBUS_SERVICE);
+-        if (symlink("/dev/null", t) < 0)
+-                return log_error_errno(errno, "Failed to mask %s: %m", t);
+-
+-        return 0;
+-}
+-
+-int main(int argc, char *argv[]) {
+-        const char *path, *type, *units;
+-        int r, q;
+-
+-        if (argc > 1 && argc != 4) {
+-                log_error("This program takes three or no arguments.");
+-                return EXIT_FAILURE;
+-        }
+-
+-        if (argc > 1) {
+-                arg_dest = argv[1];
+-                arg_dest_late = argv[3];
+-        }
+-
+-        log_set_target(LOG_TARGET_SAFE);
+-        log_parse_environment();
+-        log_open();
+-
+-        umask(0022);
+-
+-        if (!is_kdbus_available())
+-                return 0;
+-
+-        r = cg_pid_get_owner_uid(0, NULL);
+-        if (r >= 0) {
+-                path = "/usr/share/dbus-1/services";
+-                type = "session";
+-                units = USER_DATA_UNIT_PATH;
+-        } else if (r == -ENXIO) {
+-                path = "/usr/share/dbus-1/system-services";
+-                type = "system";
+-                units = SYSTEM_DATA_UNIT_PATH;
+-        } else
+-                return log_error_errno(r, "Failed to determine whether we are running as user or system instance: %m");
+-
+-        r = parse_dbus_fragments(path, type);
+-
+-        /* FIXME: One day this should just be pulled in statically from basic.target */
+-        q = link_busnames_target(units);
+-        if (q < 0)
+-                r = q;
+-
+-        q = link_compatibility(units);
+-        if (q < 0)
+-                r = q;
+-
+-        return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+-}
+Index: git/src/login/pam_systemd.c
+===================================================================
+--- git.orig/src/login/pam_systemd.c
++++ git/src/login/pam_systemd.c
+@@ -182,25 +182,20 @@ static int export_legacy_dbus_address(
+         _cleanup_free_ char *s = NULL;
+         int r = PAM_BUF_ERR;
+ 
+-        if (is_kdbus_available()) {
+-                if (asprintf(&s, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, uid, runtime) < 0)
+-                        goto error;
+-        } else {
+-                /* FIXME: We *really* should move the access() check into the
+-                 * daemons that spawn dbus-daemon, instead of forcing
+-                 * DBUS_SESSION_BUS_ADDRESS= here. */
++        /* FIXME: We *really* should move the access() check into the
++         * daemons that spawn dbus-daemon, instead of forcing
++         * DBUS_SESSION_BUS_ADDRESS= here. */
+ 
+-                s = strjoin(runtime, "/bus", NULL);
+-                if (!s)
+-                        goto error;
++        s = strjoin(runtime, "/bus", NULL);
++        if (!s)
++                goto error;
+ 
+-                if (access(s, F_OK) < 0)
+-                        return PAM_SUCCESS;
++        if (access(s, F_OK) < 0)
++                return PAM_SUCCESS;
+ 
+-                s = mfree(s);
+-                if (asprintf(&s, UNIX_USER_BUS_ADDRESS_FMT, runtime) < 0)
+-                        goto error;
+-        }
++        s = mfree(s);
++        if (asprintf(&s, UNIX_USER_BUS_ADDRESS_FMT, runtime) < 0)
++                goto error;
+ 
+         r = pam_misc_setenv(handle, "DBUS_SESSION_BUS_ADDRESS", s, 0);
+         if (r != PAM_SUCCESS)
+Index: git/src/shared/bus-util.c
+===================================================================
+--- git.orig/src/shared/bus-util.c
++++ git/src/shared/bus-util.c
+@@ -1492,40 +1492,6 @@ int bus_path_decode_unique(const char *p
+         return 1;
+ }
+ 
+-bool is_kdbus_wanted(void) {
+-        _cleanup_free_ char *value = NULL;
+-#ifdef ENABLE_KDBUS
+-        const bool configured = true;
+-#else
+-        const bool configured = false;
+-#endif
+-
+-        int r;
+-
+-        if (get_proc_cmdline_key("kdbus", NULL) > 0)
+-                return true;
+-
+-        r = get_proc_cmdline_key("kdbus=", &value);
+-        if (r <= 0)
+-                return configured;
+-
+-        return parse_boolean(value) == 1;
+-}
+-
+-bool is_kdbus_available(void) {
+-        _cleanup_close_ int fd = -1;
+-        struct kdbus_cmd cmd = { .size = sizeof(cmd), .flags = KDBUS_FLAG_NEGOTIATE };
+-
+-        if (!is_kdbus_wanted())
+-                return false;
+-
+-        fd = open("/sys/fs/kdbus/control", O_RDWR | O_CLOEXEC | O_NONBLOCK | O_NOCTTY);
+-        if (fd < 0)
+-                return false;
+-
+-        return ioctl(fd, KDBUS_CMD_BUS_MAKE, &cmd) >= 0;
+-}
+-
+ int bus_property_get_rlimit(
+                 sd_bus *bus,
+                 const char *path,
+Index: git/src/shared/bus-util.h
+===================================================================
+--- git.orig/src/shared/bus-util.h
++++ git/src/shared/bus-util.h
+@@ -157,7 +157,4 @@ int bus_log_create_error(int r);
+ int bus_path_encode_unique(sd_bus *b, const char *prefix, const char *sender_id, const char *external_id, char **ret_path);
+ int bus_path_decode_unique(const char *path, const char *prefix, char **ret_sender, char **ret_external);
+ 
+-bool is_kdbus_wanted(void);
+-bool is_kdbus_available(void);
+-
+ int bus_property_get_rlimit(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
+Index: git/Makefile.am
+===================================================================
+--- git.orig/Makefile.am
++++ git/Makefile.am
+@@ -2895,29 +2895,9 @@ systemd_gpt_auto_generator_CFLAGS = \
+ endif
+ 
+ # ------------------------------------------------------------------------------
+-systemgenerator_PROGRAMS +=  \
+-	systemd-dbus1-generator
+-
+-systemd_dbus1_generator_SOURCES = \
+-	src/dbus1-generator/dbus1-generator.c
+-
+-systemd_dbus1_generator_LDADD = \
+-	libshared.la
+-
+-dbus1-generator-install-hook:
+-	$(AM_V_at)$(MKDIR_P) $(DESTDIR)$(usergeneratordir)
+-	$(AM_V_RM)rm -f $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
+-	$(AM_V_LN)lnr $(DESTDIR)$(systemgeneratordir)/systemd-dbus1-generator $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
+-
+-dbus1-generator-uninstall-hook:
+-	rm -f $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
+-
+ dist_xinitrc_SCRIPTS = \
+ 	xorg/50-systemd-user.sh
+ 
+-INSTALL_EXEC_HOOKS += dbus1-generator-install-hook
+-UNINSTALL_EXEC_HOOKS += dbus1-generator-uninstall-hook
+-
+ # ------------------------------------------------------------------------------
+ systemd_sysv_generator_SOURCES = \
+ 	src/sysv-generator/sysv-generator.c
meta/recipes-core/systemd/systemd_230.bb +1 -2
index 40f1428..f4ff860 100644
@@ -37,6 +37,7 @@ SRC_URI += " \
            file://udev-re-enable-mount-propagation-for-udevd.patch \
            file://CVE-2016-7795.patch \
            file://validate-user.patch \
+           file://Ensure-kdbus-isn-t-used-3501.patch \
 "
 SRC_URI_append_libc-uclibc = "\
            file://0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch \
@@ -61,7 +62,6 @@ PACKAGECONFIG ??= "xz \
                    timedated \
                    timesyncd \
                    localed \
-                   kdbus \
                    ima \
                    smack \
                    logind \
@@ -96,7 +96,6 @@ PACKAGECONFIG[timedated] = "--enable-timedated,--disable-timedated"
 PACKAGECONFIG[timesyncd] = "--enable-timesyncd,--disable-timesyncd"
 PACKAGECONFIG[localed] = "--enable-localed,--disable-localed"
 PACKAGECONFIG[efi] = "--enable-efi,--disable-efi"
-PACKAGECONFIG[kdbus] = "--enable-kdbus,--disable-kdbus"
 PACKAGECONFIG[ima] = "--enable-ima,--disable-ima"
 PACKAGECONFIG[smack] = "--enable-smack,--disable-smack"
 # libseccomp is found in meta-security
Signature · 1 line
2.7.4
#1 lore raw

✗ patchtest: failure for systemd: fixs mips64 login issue

== Series Details ==

Series: systemd: fixs mips64 login issue
Revision: 1
URL : https://patchwork.openembedded.org/series/9939/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 33418ed064)

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
#2 lore raw

Re: ✗ patchtest: failure for systemd: fixs mips64 login issue

Quoted 16 lines · On Thu, 23 Nov 2017 18:37:54 -0000 Patchwork…

== Series Details ==

Series: systemd: fixs mips64 login issue
Revision: 1
URL : https://patchwork.openembedded.org/series/9939/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

Quoted 3 lines

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 33418ed064)

clearly this was not the intended branch (master). Sorry for all this patchwork/patchtest noise on this area.

Quoted 20 lines

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
Signature · 4 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
author
#3 lore raw

Re: ✗ patchtest: failure for systemd: fixs mips64 login issue

Quoted 19 lines · Leonardo Sandoval
Quoted 16 lines · On Thu, 23 Nov 2017 18:37:54 -0000 Patchwork…

== Series Details ==

Series: systemd: fixs mips64 login issue
Revision: 1
URL : https://patchwork.openembedded.org/series/9939/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

Quoted 4 lines
Quoted 3 lines

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 33418ed064)

clearly this was not the intended branch (master). Sorry for all this patchwork/patchtest noise on this area.

The benefits out way the any noise IMHO.
- armin

Quoted 20 lines
Quoted 20 lines

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
Signature · 4 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
#4 lore raw
In reply to Armin Kuster
Quoted 8 lines · Armin Kuster

From: Armin Kuster <[email protected]>

With out this patch, one can not login to a mips64 machine like qumumips64 or Octeon mips64 when systemd is enabled.

remove PACKAGECONFIG option too

affects: systemd < 2.3.2

                                 ^^^^^

a typo otherwise ok.

Quoted 722 lines
---
 .../systemd/Ensure-kdbus-isn-t-used-3501.patch     | 670 +++++++++++++++++++++
 meta/recipes-core/systemd/systemd_230.bb           |   3 +-
 2 files changed, 671 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t-used-3501.patch
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t-used-3501.patch new file +670 -0
new file mode 100644
index 0000000..d08a10f
@@ -0,0 +1,670 @@
+From 222953e87f34545a3f9c6d3c18216e222bf6ea94 Mon Sep 17 00:00:00 2001
+From: Dave Reisner <[email protected]>
+Date: Fri, 10 Jun 2016 09:50:16 -0400
+Subject: [PATCH] Ensure kdbus isn't used (#3501)
+
+Delete the dbus1 generator and some critical wiring. This prevents
+kdbus from being loaded or detected. As such, it will never be used,
+even if the user still has a useful kdbus module loaded on their system.
+
+Sort of fixes #3480. Not really, but it's better than the current state.
+
+Upstream-Status: Backport
+Signed-off-by: Armin Kuster <[email protected]>
+
+---
+ Makefile.am                           |  20 --
+ autogen.sh                            |  12 +-
+ configure.ac                          |  10 -
+ src/core/busname.c                    |   7 +-
+ src/core/kmod-setup.c                 |   3 -
+ src/core/manager.c                    |  23 ---
+ src/core/mount-setup.c                |   2 -
+ src/core/service.c                    |  17 +-
+ src/dbus1-generator/dbus1-generator.c | 331 ----------------------------------
+ src/login/pam_systemd.c               |  31 ++--
+ src/shared/bus-util.c                 |  34 ----
+ src/shared/bus-util.h                 |   3 -
+ 12 files changed, 23 insertions(+), 470 deletions(-)
+ delete mode 100644 src/dbus1-generator/dbus1-generator.c
+
+Index: git/autogen.sh
+===================================================================
+--- git.orig/autogen.sh
++++ git/autogen.sh
+@@ -55,19 +55,19 @@ fi
+ cd $oldpwd
+
+ if [ "x$1" = "xc" ]; then
+-        $topdir/configure CFLAGS='-g -O0 -ftrapv' --enable-kdbus $args
++        $topdir/configure CFLAGS='-g -O0 -ftrapv' $args
+         make clean
+ elif [ "x$1" = "xg" ]; then
+-        $topdir/configure CFLAGS='-g -Og -ftrapv' --enable-kdbus $args
++        $topdir/configure CFLAGS='-g -Og -ftrapv' $args
+         make clean
+ elif [ "x$1" = "xa" ]; then
+-        $topdir/configure CFLAGS='-g -O0 -Wsuggest-attribute=pure -Wsuggest-attribute=const -ftrapv' --enable-kdbus $args
++        $topdir/configure CFLAGS='-g -O0 -Wsuggest-attribute=pure -Wsuggest-attribute=const -ftrapv' $args
+         make clean
+ elif [ "x$1" = "xl" ]; then
+-        $topdir/configure CC=clang CFLAGS='-g -O0 -ftrapv' --enable-kdbus $args
++        $topdir/configure CC=clang CFLAGS='-g -O0 -ftrapv' $args
+         make clean
+ elif [ "x$1" = "xs" ]; then
+-        scan-build $topdir/configure CFLAGS='-std=gnu99 -g -O0 -ftrapv' --enable-kdbus $args
++        scan-build $topdir/configure CFLAGS='-std=gnu99 -g -O0 -ftrapv' $args
+         scan-build make
+ else
+         echo
+@@ -75,6 +75,6 @@ else
+         echo "Initialized build system. For a common configuration please run:"
+         echo "----------------------------------------------------------------"
+         echo
+-        echo "$topdir/configure CFLAGS='-g -O0 -ftrapv' --enable-kdbus $args"
++        echo "$topdir/configure CFLAGS='-g -O0 -ftrapv' $args"
+         echo
+ fi
+Index: git/configure.ac
+===================================================================
+--- git.orig/configure.ac
++++ git/configure.ac
+@@ -1294,16 +1294,6 @@ AC_ARG_WITH(tpm-pcrindex,
+ AC_DEFINE_UNQUOTED(SD_TPM_PCR, [$SD_TPM_PCR], [TPM PCR register number to use])
+
+ # ------------------------------------------------------------------------------
+-have_kdbus=no
+-AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--disable-kdbus], [do not connect to kdbus by default]))
+-if test "x$enable_kdbus" != "xno"; then
+-        AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus is to be connected to by default])
+-        have_kdbus=yes
+-        M4_DEFINES="$M4_DEFINES -DENABLE_KDBUS"
+-fi
+-AM_CONDITIONAL(ENABLE_KDBUS, [test "$have_kdbus" = "yes"])
+-
+-# ------------------------------------------------------------------------------
+ AC_ARG_WITH(rc-local-script-path-start,
+         AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
+                 [Path to /etc/rc.local]),
+Index: git/src/core/busname.c
+===================================================================
+--- git.orig/src/core/busname.c
++++ git/src/core/busname.c
+@@ -998,12 +998,7 @@ static int busname_get_timeout(Unit *u,
+ }
+
+ static bool busname_supported(void) {
+-        static int supported = -1;
+-
+-        if (supported < 0)
+-                supported = is_kdbus_available();
+-
+-        return supported;
++        return false;
+ }
+
+ static int busname_control_pid(Unit *u) {
+Index: git/src/core/kmod-setup.c
+===================================================================
+--- git.orig/src/core/kmod-setup.c
++++ git/src/core/kmod-setup.c
+@@ -64,9 +64,6 @@ int kmod_setup(void) {
+                 /* this should never be a module */
+                 { "unix",      "/proc/net/unix",            true,   true,    NULL      },
+
+-                /* IPC is needed before we bring up any other services */
+-                { "kdbus",     "/sys/fs/kdbus",             false,  false,   is_kdbus_wanted },
+-
+ #ifdef HAVE_LIBIPTC
+                 /* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */
+                 { "ip_tables", "/proc/net/ip_tables_names", false,  false,   NULL      },
+Index: git/src/core/manager.c
+===================================================================
+--- git.orig/src/core/manager.c
++++ git/src/core/manager.c
+@@ -809,28 +809,6 @@ static int manager_setup_cgroups_agent(M
+         return 0;
+ }
+
+-static int manager_setup_kdbus(Manager *m) {
+-        _cleanup_free_ char *p = NULL;
+-
+-        assert(m);
+-
+-        if (m->test_run || m->kdbus_fd >= 0)
+-                return 0;
+-        if (!is_kdbus_available())
+-                return -ESOCKTNOSUPPORT;
+-
+-        m->kdbus_fd = bus_kernel_create_bus(
+-                        MANAGER_IS_SYSTEM(m) ? "system" : "user",
+-                        MANAGER_IS_SYSTEM(m), &p);
+-
+-        if (m->kdbus_fd < 0)
+-                return log_debug_errno(m->kdbus_fd, "Failed to set up kdbus: %m");
+-
+-        log_debug("Successfully set up kdbus on %s", p);
+-
+-        return 0;
+-}
+-
+ static int manager_connect_bus(Manager *m, bool reexecuting) {
+         bool try_bus_connect;
+
+@@ -1225,7 +1203,6 @@ int manager_startup(Manager *m, FILE *se
+
+         /* We might have deserialized the kdbus control fd, but if we
+          * didn't, then let's create the bus now. */
+-        manager_setup_kdbus(m);
+         manager_connect_bus(m, !!serialization);
+         bus_track_coldplug(m, &m->subscribed, &m->deserialized_subscribed);
+
+Index: git/src/core/mount-setup.c
+===================================================================
+--- git.orig/src/core/mount-setup.c
++++ git/src/core/mount-setup.c
+@@ -108,8 +108,6 @@ static const MountPoint mount_table[] =
+         { "efivarfs",    "/sys/firmware/efi/efivars", "efivarfs",   NULL,                      MS_NOSUID|MS_NOEXEC|MS_NODEV,
+           is_efi_boot,   MNT_NONE                   },
+ #endif
+-        { "kdbusfs",    "/sys/fs/kdbus",             "kdbusfs",    NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
+-          is_kdbus_wanted,       MNT_IN_CONTAINER },
+ };
+
+ /* These are API file systems that might be mounted by other software,
+Index: git/src/core/service.c
+===================================================================
+--- git.orig/src/core/service.c
++++ git/src/core/service.c
+@@ -574,20 +574,9 @@ static int service_setup_bus_name(Servic
+         if (!s->bus_name)
+                 return 0;
+
+-        if (is_kdbus_available()) {
+-                const char *n;
+-
+-                n = strjoina(s->bus_name, ".busname");
+-                r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, n, NULL, true);
+-                if (r < 0)
+-                        return log_unit_error_errno(UNIT(s), r, "Failed to add dependency to .busname unit: %m");
+-
+-        } else {
+-                /* If kdbus is not available, we know the dbus socket is required, hence pull it in, and require it */
+-                r = unit_add_dependency_by_name(UNIT(s), UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, NULL, true);
+-                if (r < 0)
+-                        return log_unit_error_errno(UNIT(s), r, "Failed to add dependency on " SPECIAL_DBUS_SOCKET ": %m");
+-        }
++        r = unit_add_dependency_by_name(UNIT(s), UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, NULL, true);
++        if (r < 0)
++                return log_unit_error_errno(UNIT(s), r, "Failed to add dependency on " SPECIAL_DBUS_SOCKET ": %m");
+
+         /* Regardless if kdbus is used or not, we always want to be ordered against dbus.socket if both are in the transaction. */
+         r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, SPECIAL_DBUS_SOCKET, NULL, true);
+Index: git/src/dbus1-generator/dbus1-generator.c
+===================================================================
+--- git.orig/src/dbus1-generator/dbus1-generator.c
++++ /dev/null
+@@ -1,331 +0,0 @@
+-/***
+-  This file is part of systemd.
+-
+-  Copyright 2013 Lennart Poettering
+-
+-  systemd is free software; you can redistribute it and/or modify it
+-  under the terms of the GNU Lesser General Public License as published by
+-  the Free Software Foundation; either version 2.1 of the License, or
+-  (at your option) any later version.
+-
+-  systemd is distributed in the hope that it will be useful, but
+-  WITHOUT ANY WARRANTY; without even the implied warranty of
+-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-  Lesser General Public License for more details.
+-
+-  You should have received a copy of the GNU Lesser General Public License
+-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-***/
+-
+-#include "alloc-util.h"
+-#include "bus-internal.h"
+-#include "bus-util.h"
+-#include "cgroup-util.h"
+-#include "conf-parser.h"
+-#include "dirent-util.h"
+-#include "fd-util.h"
+-#include "fileio.h"
+-#include "mkdir.h"
+-#include "special.h"
+-#include "unit-name.h"
+-#include "util.h"
+-
+-static const char *arg_dest_late = "/tmp", *arg_dest = "/tmp";
+-
+-static int create_dbus_files(
+-                const char *path,
+-                const char *name,
+-                const char *service,
+-                const char *exec,
+-                const char *user,
+-                const char *type) {
+-
+-        _cleanup_free_ char *b = NULL, *s = NULL, *lnk = NULL;
+-        _cleanup_fclose_ FILE *f = NULL;
+-        int r;
+-
+-        assert(path);
+-        assert(name);
+-        assert(service || exec);
+-
+-        if (!service) {
+-                _cleanup_free_ char *a = NULL;
+-
+-                s = strjoin("dbus-", name, ".service", NULL);
+-                if (!s)
+-                        return log_oom();
+-
+-                a = strjoin(arg_dest_late, "/", s, NULL);
+-                if (!a)
+-                        return log_oom();
+-
+-                f = fopen(a, "wxe");
+-                if (!f)
+-                        return log_error_errno(errno, "Failed to create %s: %m", a);
+-
+-                fprintf(f,
+-                        "# Automatically generated by systemd-dbus1-generator\n\n"
+-                        "[Unit]\n"
+-                        "SourcePath=%s\n"
+-                        "Description=DBUS1: %s\n"
+-                        "Documentation=man:systemd-dbus1-generator(8)\n\n"
+-                        "[Service]\n"
+-                        "ExecStart=%s\n"
+-                        "Type=dbus\n"
+-                        "BusName=%s\n",
+-                        path,
+-                        name,
+-                        exec,
+-                        name);
+-
+-                if (user)
+-                        fprintf(f, "User=%s\n", user);
+-
+-
+-                if (type) {
+-                        fprintf(f, "Environment=DBUS_STARTER_BUS_TYPE=%s\n", type);
+-
+-                        if (streq(type, "system"))
+-                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS=" DEFAULT_SYSTEM_BUS_ADDRESS "\n");
+-                        else if (streq(type, "session")) {
+-                                char *run;
+-
+-                                run = getenv("XDG_RUNTIME_DIR");
+-                                if (!run) {
+-                                        log_error("XDG_RUNTIME_DIR not set.");
+-                                        return -EINVAL;
+-                                }
+-
+-                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS="KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT "\n",
+-                                        getuid(), run);
+-                        }
+-                }
+-
+-                r = fflush_and_check(f);
+-                if (r < 0)
+-                        return log_error_errno(r, "Failed to write %s: %m", a);
+-
+-                f = safe_fclose(f);
+-
+-                service = s;
+-        }
+-
+-        b = strjoin(arg_dest_late, "/", name, ".busname", NULL);
+-        if (!b)
+-                return log_oom();
+-
+-        f = fopen(b, "wxe");
+-        if (!f)
+-                return log_error_errno(errno, "Failed to create %s: %m", b);
+-
+-        fprintf(f,
+-                "# Automatically generated by systemd-dbus1-generator\n\n"
+-                "[Unit]\n"
+-                "SourcePath=%s\n"
+-                "Description=DBUS1: %s\n"
+-                "Documentation=man:systemd-dbus1-generator(8)\n\n"
+-                "[BusName]\n"
+-                "Name=%s\n"
+-                "Service=%s\n"
+-                "AllowWorld=talk\n",
+-                path,
+-                name,
+-                name,
+-                service);
+-
+-        r = fflush_and_check(f);
+-        if (r < 0)
+-                return log_error_errno(r, "Failed to write %s: %m", b);
+-
+-        lnk = strjoin(arg_dest_late, "/" SPECIAL_BUSNAMES_TARGET ".wants/", name, ".busname", NULL);
+-        if (!lnk)
+-                return log_oom();
+-
+-        mkdir_parents_label(lnk, 0755);
+-        if (symlink(b, lnk))
+-                return log_error_errno(errno, "Failed to create symlink %s: %m", lnk);
+-
+-        return 0;
+-}
+-
+-static int add_dbus(const char *path, const char *fname, const char *type) {
+-        _cleanup_free_ char *name = NULL, *exec = NULL, *user = NULL, *service = NULL;
+-
+-        const ConfigTableItem table[] = {
+-                { "D-BUS Service", "Name", config_parse_string, 0, &name },
+-                { "D-BUS Service", "Exec", config_parse_string, 0, &exec },
+-                { "D-BUS Service", "User", config_parse_string, 0, &user },
+-                { "D-BUS Service", "SystemdService", config_parse_string, 0, &service },
+-                { },
+-        };
+-
+-        char *p;
+-        int r;
+-
+-        assert(path);
+-        assert(fname);
+-
+-        p = strjoina(path, "/", fname);
+-        r = config_parse(NULL, p, NULL,
+-                         "D-BUS Service\0",
+-                         config_item_table_lookup, table,
+-                         true, false, true, NULL);
+-        if (r < 0)
+-                return r;
+-
+-        if (!name) {
+-                log_warning("Activation file %s lacks name setting, ignoring.", p);
+-                return 0;
+-        }
+-
+-        if (!service_name_is_valid(name)) {
+-                log_warning("Bus service name %s is not valid, ignoring.", name);
+-                return 0;
+-        }
+-
+-        if (streq(name, "org.freedesktop.systemd1")) {
+-                log_debug("Skipping %s, identified as systemd.", p);
+-                return 0;
+-        }
+-
+-        if (service) {
+-                if (!unit_name_is_valid(service, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE)) {
+-                        log_warning("Unit name %s is not valid, ignoring.", service);
+-                        return 0;
+-                }
+-                if (!endswith(service, ".service")) {
+-                        log_warning("Bus names can only activate services, ignoring %s.", p);
+-                        return 0;
+-                }
+-        } else {
+-                if (streq(exec, "/bin/false") || !exec) {
+-                        log_warning("Neither service name nor binary path specified, ignoring %s.", p);
+-                        return 0;
+-                }
+-
+-                if (exec[0] != '/') {
+-                        log_warning("Exec= in %s does not start with an absolute path, ignoring.", p);
+-                        return 0;
+-                }
+-        }
+-
+-        return create_dbus_files(p, name, service, exec, user, type);
+-}
+-
+-static int parse_dbus_fragments(const char *path, const char *type) {
+-        _cleanup_closedir_ DIR *d = NULL;
+-        struct dirent *de;
+-        int r;
+-
+-        assert(path);
+-        assert(type);
+-
+-        d = opendir(path);
+-        if (!d) {
+-                if (errno == -ENOENT)
+-                        return 0;
+-
+-                return log_error_errno(errno, "Failed to enumerate D-Bus activated services: %m");
+-        }
+-
+-        r = 0;
+-        FOREACH_DIRENT(de, d, goto fail) {
+-                int q;
+-
+-                if (!endswith(de->d_name, ".service"))
+-                        continue;
+-
+-                q = add_dbus(path, de->d_name, type);
+-                if (q < 0)
+-                        r = q;
+-        }
+-
+-        return r;
+-
+-fail:
+-        return log_error_errno(errno, "Failed to read D-Bus services directory: %m");
+-}
+-
+-static int link_busnames_target(const char *units) {
+-        const char *f, *t;
+-
+-        f = strjoina(units, "/" SPECIAL_BUSNAMES_TARGET);
+-        t = strjoina(arg_dest, "/" SPECIAL_BASIC_TARGET ".wants/" SPECIAL_BUSNAMES_TARGET);
+-
+-        mkdir_parents_label(t, 0755);
+-        if (symlink(f, t) < 0)
+-                return log_error_errno(errno, "Failed to create symlink %s: %m", t);
+-
+-        return 0;
+-}
+-
+-static int link_compatibility(const char *units) {
+-        const char *f, *t;
+-
+-        f = strjoina(units, "/systemd-bus-proxyd.socket");
+-        t = strjoina(arg_dest, "/" SPECIAL_DBUS_SOCKET);
+-        mkdir_parents_label(t, 0755);
+-        if (symlink(f, t) < 0)
+-                return log_error_errno(errno, "Failed to create symlink %s: %m", t);
+-
+-        f = strjoina(units, "/systemd-bus-proxyd.socket");
+-        t = strjoina(arg_dest, "/" SPECIAL_SOCKETS_TARGET ".wants/systemd-bus-proxyd.socket");
+-        mkdir_parents_label(t, 0755);
+-        if (symlink(f, t) < 0)
+-                return log_error_errno(errno, "Failed to create symlink %s: %m", t);
+-
+-        t = strjoina(arg_dest, "/" SPECIAL_DBUS_SERVICE);
+-        if (symlink("/dev/null", t) < 0)
+-                return log_error_errno(errno, "Failed to mask %s: %m", t);
+-
+-        return 0;
+-}
+-
+-int main(int argc, char *argv[]) {
+-        const char *path, *type, *units;
+-        int r, q;
+-
+-        if (argc > 1 && argc != 4) {
+-                log_error("This program takes three or no arguments.");
+-                return EXIT_FAILURE;
+-        }
+-
+-        if (argc > 1) {
+-                arg_dest = argv[1];
+-                arg_dest_late = argv[3];
+-        }
+-
+-        log_set_target(LOG_TARGET_SAFE);
+-        log_parse_environment();
+-        log_open();
+-
+-        umask(0022);
+-
+-        if (!is_kdbus_available())
+-                return 0;
+-
+-        r = cg_pid_get_owner_uid(0, NULL);
+-        if (r >= 0) {
+-                path = "/usr/share/dbus-1/services";
+-                type = "session";
+-                units = USER_DATA_UNIT_PATH;
+-        } else if (r == -ENXIO) {
+-                path = "/usr/share/dbus-1/system-services";
+-                type = "system";
+-                units = SYSTEM_DATA_UNIT_PATH;
+-        } else
+-                return log_error_errno(r, "Failed to determine whether we are running as user or system instance: %m");
+-
+-        r = parse_dbus_fragments(path, type);
+-
+-        /* FIXME: One day this should just be pulled in statically from basic.target */
+-        q = link_busnames_target(units);
+-        if (q < 0)
+-                r = q;
+-
+-        q = link_compatibility(units);
+-        if (q < 0)
+-                r = q;
+-
+-        return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+-}
+Index: git/src/login/pam_systemd.c
+===================================================================
+--- git.orig/src/login/pam_systemd.c
++++ git/src/login/pam_systemd.c
+@@ -182,25 +182,20 @@ static int export_legacy_dbus_address(
+         _cleanup_free_ char *s = NULL;
+         int r = PAM_BUF_ERR;
+
+-        if (is_kdbus_available()) {
+-                if (asprintf(&s, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, uid, runtime) < 0)
+-                        goto error;
+-        } else {
+-                /* FIXME: We *really* should move the access() check into the
+-                 * daemons that spawn dbus-daemon, instead of forcing
+-                 * DBUS_SESSION_BUS_ADDRESS= here. */
++        /* FIXME: We *really* should move the access() check into the
++         * daemons that spawn dbus-daemon, instead of forcing
++         * DBUS_SESSION_BUS_ADDRESS= here. */
+
+-                s = strjoin(runtime, "/bus", NULL);
+-                if (!s)
+-                        goto error;
++        s = strjoin(runtime, "/bus", NULL);
++        if (!s)
++                goto error;
+
+-                if (access(s, F_OK) < 0)
+-                        return PAM_SUCCESS;
++        if (access(s, F_OK) < 0)
++                return PAM_SUCCESS;
+
+-                s = mfree(s);
+-                if (asprintf(&s, UNIX_USER_BUS_ADDRESS_FMT, runtime) < 0)
+-                        goto error;
+-        }
++        s = mfree(s);
++        if (asprintf(&s, UNIX_USER_BUS_ADDRESS_FMT, runtime) < 0)
++                goto error;
+
+         r = pam_misc_setenv(handle, "DBUS_SESSION_BUS_ADDRESS", s, 0);
+         if (r != PAM_SUCCESS)
+Index: git/src/shared/bus-util.c
+===================================================================
+--- git.orig/src/shared/bus-util.c
++++ git/src/shared/bus-util.c
+@@ -1492,40 +1492,6 @@ int bus_path_decode_unique(const char *p
+         return 1;
+ }
+
+-bool is_kdbus_wanted(void) {
+-        _cleanup_free_ char *value = NULL;
+-#ifdef ENABLE_KDBUS
+-        const bool configured = true;
+-#else
+-        const bool configured = false;
+-#endif
+-
+-        int r;
+-
+-        if (get_proc_cmdline_key("kdbus", NULL) > 0)
+-                return true;
+-
+-        r = get_proc_cmdline_key("kdbus=", &value);
+-        if (r <= 0)
+-                return configured;
+-
+-        return parse_boolean(value) == 1;
+-}
+-
+-bool is_kdbus_available(void) {
+-        _cleanup_close_ int fd = -1;
+-        struct kdbus_cmd cmd = { .size = sizeof(cmd), .flags = KDBUS_FLAG_NEGOTIATE };
+-
+-        if (!is_kdbus_wanted())
+-                return false;
+-
+-        fd = open("/sys/fs/kdbus/control", O_RDWR | O_CLOEXEC | O_NONBLOCK | O_NOCTTY);
+-        if (fd < 0)
+-                return false;
+-
+-        return ioctl(fd, KDBUS_CMD_BUS_MAKE, &cmd) >= 0;
+-}
+-
+ int bus_property_get_rlimit(
+                 sd_bus *bus,
+                 const char *path,
+Index: git/src/shared/bus-util.h
+===================================================================
+--- git.orig/src/shared/bus-util.h
++++ git/src/shared/bus-util.h
+@@ -157,7 +157,4 @@ int bus_log_create_error(int r);
+ int bus_path_encode_unique(sd_bus *b, const char *prefix, const char *sender_id, const char *external_id, char **ret_path);
+ int bus_path_decode_unique(const char *path, const char *prefix, char **ret_sender, char **ret_external);
+
+-bool is_kdbus_wanted(void);
+-bool is_kdbus_available(void);
+-
+ int bus_property_get_rlimit(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
+Index: git/Makefile.am
+===================================================================
+--- git.orig/Makefile.am
++++ git/Makefile.am
+@@ -2895,29 +2895,9 @@ systemd_gpt_auto_generator_CFLAGS = \
+ endif
+
+ # ------------------------------------------------------------------------------
+-systemgenerator_PROGRAMS +=  \
+-      systemd-dbus1-generator
+-
+-systemd_dbus1_generator_SOURCES = \
+-      src/dbus1-generator/dbus1-generator.c
+-
+-systemd_dbus1_generator_LDADD = \
+-      libshared.la
+-
+-dbus1-generator-install-hook:
+-      $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(usergeneratordir)
+-      $(AM_V_RM)rm -f $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
+-      $(AM_V_LN)lnr $(DESTDIR)$(systemgeneratordir)/systemd-dbus1-generator $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
+-
+-dbus1-generator-uninstall-hook:
+-      rm -f $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
+-
+ dist_xinitrc_SCRIPTS = \
+       xorg/50-systemd-user.sh
+
+-INSTALL_EXEC_HOOKS += dbus1-generator-install-hook
+-UNINSTALL_EXEC_HOOKS += dbus1-generator-uninstall-hook
+-
+ # ------------------------------------------------------------------------------
+ systemd_sysv_generator_SOURCES = \
+       src/sysv-generator/sysv-generator.c
meta/recipes-core/systemd/systemd_230.bb +1 -3
index 40f1428..f4ff860 100644
@@ -37,6 +37,7 @@ SRC_URI += " \
            file://udev-re-enable-mount-propagation-for-udevd.patch \
            file://CVE-2016-7795.patch \
            file://validate-user.patch \
+           file://Ensure-kdbus-isn-t-used-3501.patch \
 "
 SRC_URI_append_libc-uclibc = "\
            file://0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch \
@@ -61,7 +62,6 @@ PACKAGECONFIG ??= "xz \
                    timedated \
                    timesyncd \
                    localed \
-                   kdbus \
                    ima \
                    smack \
                    logind \
@@ -96,7 +96,6 @@ PACKAGECONFIG[timedated] = "--enable-timedated,--disable-timedated"
 PACKAGECONFIG[timesyncd] = "--enable-timesyncd,--disable-timesyncd"
 PACKAGECONFIG[localed] = "--enable-localed,--disable-localed"
 PACKAGECONFIG[efi] = "--enable-efi,--disable-efi"
-PACKAGECONFIG[kdbus] = "--enable-kdbus,--disable-kdbus"
 PACKAGECONFIG[ima] = "--enable-ima,--disable-ima"
 PACKAGECONFIG[smack] = "--enable-smack,--disable-smack"
 # libseccomp is found in meta-security
--

2.7.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#5 lore raw

The patch (Ensure-kdbus-isn-t-used-3501.patch) is already part of systemd v2.3.1.
The issue comes on systemd < 2.3.1.

Regards,
Jagadeesh

Quoted 832 lines · Khem Raj
Quoted 3 lines · Armin Kuster

From: Armin Kuster <[email protected]>

With out this patch, one can not login to a mips64 machine like

qumumips64 or Octeon mips64 when

Quoted 5 lines

systemd is enabled.

remove PACKAGECONFIG option too

affects: systemd < 2.3.2

                                 ^^^^^

a typo otherwise ok.

Quoted 6 lines
---
 .../systemd/Ensure-kdbus-isn-t-used-3501.patch     | 670

+++++++++++++++++++++

Quoted 3 lines
 meta/recipes-core/systemd/systemd_230.bb           |   3 +-
 2 files changed, 671 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/systemd/

systemd/Ensure-kdbus-isn-t-used-3501.patch

Review

Quoted 2 lines
(quoted diff) +0 -0

b/meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t-used-3501.patch

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t-

Quoted 4 lines

new file mode 100644
index 0000000..d08a10f

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +0 -0

used-3501.patch

Quoted 15 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +14 -0
@@ -0,0 +1,670 @@
+From 222953e87f34545a3f9c6d3c18216e222bf6ea94 Mon Sep 17 00:00:00 2001
+From: Dave Reisner <[email protected]>
+Date: Fri, 10 Jun 2016 09:50:16 -0400
+Subject: [PATCH] Ensure kdbus isn't used (#3501)
+
+Delete the dbus1 generator and some critical wiring. This prevents
+kdbus from being loaded or detected. As such, it will never be used,
+even if the user still has a useful kdbus module loaded on their system.
+
+Sort of fixes #3480. Not really, but it's better than the current state.
+
+Upstream-Status: Backport
+Signed-off-by: Armin Kuster <[email protected]>
+

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 24

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+---
+ Makefile.am                           |  20 --
+ autogen.sh                            |  12 +-
+ configure.ac                          |  10 -
+ src/core/busname.c                    |   7 +-
+ src/core/kmod-setup.c                 |   3 -
+ src/core/manager.c                    |  23 ---
+ src/core/mount-setup.c                |   2 -
+ src/core/service.c                    |  17 +-
+ src/dbus1-generator/dbus1-generator.c | 331

----------------------------------

Quoted 13 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +13 -0
+ src/login/pam_systemd.c               |  31 ++--
+ src/shared/bus-util.c                 |  34 ----
+ src/shared/bus-util.h                 |   3 -
+ 12 files changed, 23 insertions(+), 470 deletions(-)
+ delete mode 100644 src/dbus1-generator/dbus1-generator.c
+
+Index: git/autogen.sh
+===================================================================
+--- git.orig/autogen.sh
++++ git/autogen.sh
+@@ -55,19 +55,19 @@ fi
+ cd $oldpwd
+

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 47

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+ if [ "x$1" = "xc" ]; then
+-        $topdir/configure CFLAGS='-g -O0 -ftrapv' --enable-kdbus $args
++        $topdir/configure CFLAGS='-g -O0 -ftrapv' $args
+         make clean
+ elif [ "x$1" = "xg" ]; then
+-        $topdir/configure CFLAGS='-g -Og -ftrapv' --enable-kdbus $args
++        $topdir/configure CFLAGS='-g -Og -ftrapv' $args
+         make clean
+ elif [ "x$1" = "xa" ]; then
+-        $topdir/configure CFLAGS='-g -O0 -Wsuggest-attribute=pure

-Wsuggest-attribute=const -ftrapv' --enable-kdbus $args

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 48

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
++        $topdir/configure CFLAGS='-g -O0 -Wsuggest-attribute=pure

-Wsuggest-attribute=const -ftrapv' $args

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 51

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +3 -0
+         make clean
+ elif [ "x$1" = "xl" ]; then
+-        $topdir/configure CC=clang CFLAGS='-g -O0 -ftrapv'

--enable-kdbus $args

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 55

Quoted 4 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +4 -0
++        $topdir/configure CC=clang CFLAGS='-g -O0 -ftrapv' $args
+         make clean
+ elif [ "x$1" = "xs" ]; then
+-        scan-build $topdir/configure CFLAGS='-std=gnu99 -g -O0

-ftrapv' --enable-kdbus $args

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 56

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
++        scan-build $topdir/configure CFLAGS='-std=gnu99 -g -O0

-ftrapv' $args

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 61

Quoted 5 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +5 -0
+         scan-build make
+ else
+         echo
+@@ -75,6 +75,6 @@ else
+         echo "Initialized build system. For a common configuration

please run:"

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 62

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+         echo "-----------------------------

-----------------------------------"

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 64

Quoted 2 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +2 -0
+         echo
+-        echo "$topdir/configure CFLAGS='-g -O0 -ftrapv' --enable-kdbus

$args"

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 73

Quoted 9 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +9 -0
++        echo "$topdir/configure CFLAGS='-g -O0 -ftrapv' $args"
+         echo
+ fi
+Index: git/configure.ac
+===================================================================
+--- git.orig/configure.ac
++++ git/configure.ac
+@@ -1294,16 +1294,6 @@ AC_ARG_WITH(tpm-pcrindex,
+ AC_DEFINE_UNQUOTED(SD_TPM_PCR, [$SD_TPM_PCR], [TPM PCR register number

to use])

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 75

Quoted 2 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +2 -0
+
+ # ------------------------------------------------------------

------------------

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 77

Quoted 2 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +2 -0
+-have_kdbus=no
+-AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--disable-kdbus], [do not

connect to kdbus by default]))

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 79

Quoted 2 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +2 -0
+-if test "x$enable_kdbus" != "xno"; then
+-        AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus is to be connected

to by default])

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 85

Quoted 6 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +6 -0
+-        have_kdbus=yes
+-        M4_DEFINES="$M4_DEFINES -DENABLE_KDBUS"
+-fi
+-AM_CONDITIONAL(ENABLE_KDBUS, [test "$have_kdbus" = "yes"])
+-
+-# ------------------------------------------------------------

------------------

Quoted 18 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +18 -0
+ AC_ARG_WITH(rc-local-script-path-start,
+         AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
+                 [Path to /etc/rc.local]),
+Index: git/src/core/busname.c
+===================================================================
+--- git.orig/src/core/busname.c
++++ git/src/core/busname.c
+@@ -998,12 +998,7 @@ static int busname_get_timeout(Unit *u,
+ }
+
+ static bool busname_supported(void) {
+-        static int supported = -1;
+-
+-        if (supported < 0)
+-                supported = is_kdbus_available();
+-
+-        return supported;
++        return false;

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 113

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+ }
+
+ static int busname_control_pid(Unit *u) {
+Index: git/src/core/kmod-setup.c
+===================================================================
+--- git.orig/src/core/kmod-setup.c
++++ git/src/core/kmod-setup.c
+@@ -64,9 +64,6 @@ int kmod_setup(void) {
+                 /* this should never be a module */
+                 { "unix",      "/proc/net/unix",            true,

true, NULL },

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 115

Quoted 2 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +2 -0
+
+-                /* IPC is needed before we bring up any other services

*/

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 116

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+-                { "kdbus",     "/sys/fs/kdbus",             false,

false, is_kdbus_wanted },

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 119

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +3 -0
+-
+ #ifdef HAVE_LIBIPTC
+                 /* netfilter is needed by networkd, nspawn among

others, and cannot be autoloaded */

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 120

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+                 { "ip_tables", "/proc/net/ip_tables_names", false,

false, NULL },

Quoted 14 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +14 -0
+Index: git/src/core/manager.c
+===================================================================
+--- git.orig/src/core/manager.c
++++ git/src/core/manager.c
+@@ -809,28 +809,6 @@ static int manager_setup_cgroups_agent(M
+         return 0;
+ }
+
+-static int manager_setup_kdbus(Manager *m) {
+-        _cleanup_free_ char *p = NULL;
+-
+-        assert(m);
+-
+-        if (m->test_run || m->kdbus_fd >= 0)

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 144

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-                return 0;
+-        if (!is_kdbus_available())
+-                return -ESOCKTNOSUPPORT;
+-
+-        m->kdbus_fd = bus_kernel_create_bus(
+-                        MANAGER_IS_SYSTEM(m) ? "system" : "user",
+-                        MANAGER_IS_SYSTEM(m), &p);
+-
+-        if (m->kdbus_fd < 0)
+-                return log_debug_errno(m->kdbus_fd, "Failed to set up

kdbus: %m");

Quoted 6 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +6 -0
+-
+-        log_debug("Successfully set up kdbus on %s", p);
+-
+-        return 0;
+-}
+-

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 160

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+ static int manager_connect_bus(Manager *m, bool reexecuting) {
+         bool try_bus_connect;
+
+@@ -1225,7 +1203,6 @@ int manager_startup(Manager *m, FILE *se
+
+         /* We might have deserialized the kdbus control fd, but if we
+          * didn't, then let's create the bus now. */
+-        manager_setup_kdbus(m);
+         manager_connect_bus(m, !!serialization);
+         bus_track_coldplug(m, &m->subscribed,

&m->deserialized_subscribed);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 167

Quoted 7 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +7 -0
+
+Index: git/src/core/mount-setup.c
+===================================================================
+--- git.orig/src/core/mount-setup.c
++++ git/src/core/mount-setup.c
+@@ -108,8 +108,6 @@ static const MountPoint mount_table[] =
+         { "efivarfs",    "/sys/firmware/efi/efivars", "efivarfs",

NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 170

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +3 -0
+           is_efi_boot,   MNT_NONE                   },
+ #endif
+-        { "kdbusfs",    "/sys/fs/kdbus",             "kdbusfs",

NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,

Quoted 7 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +7 -0
+-          is_kdbus_wanted,       MNT_IN_CONTAINER },
+ };
+
+ /* These are API file systems that might be mounted by other software,
+Index: git/src/core/service.c
+===================================================================
+--- git.orig/src/core/service.c

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 187

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
++++ git/src/core/service.c
+@@ -574,20 +574,9 @@ static int service_setup_bus_name(Servic
+         if (!s->bus_name)
+                 return 0;
+
+-        if (is_kdbus_available()) {
+-                const char *n;
+-
+-                n = strjoina(s->bus_name, ".busname");
+-                r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER,

n, NULL, true);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 189

Quoted 2 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +2 -0
+-                if (r < 0)
+-                        return log_unit_error_errno(UNIT(s), r,

"Failed to add dependency to .busname unit: %m");

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 192

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +3 -0
+-
+-        } else {
+-                /* If kdbus is not available, we know the dbus socket

is required, hence pull it in, and require it */

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 193

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+-                r = unit_add_dependency_by_name(UNIT(s),

UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, NULL, true);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 195

Quoted 2 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +2 -0
+-                if (r < 0)
+-                        return log_unit_error_errno(UNIT(s), r,

"Failed to add dependency on " SPECIAL_DBUS_SOCKET ": %m");

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 197

Quoted 2 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +2 -0
+-        }
++        r = unit_add_dependency_by_name(UNIT(s), UNIT_REQUIRES,

SPECIAL_DBUS_SOCKET, NULL, true);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 199

Quoted 2 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +2 -0
++        if (r < 0)
++                return log_unit_error_errno(UNIT(s), r, "Failed to add

dependency on " SPECIAL_DBUS_SOCKET ": %m");

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 201

Quoted 2 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +2 -0
+
+         /* Regardless if kdbus is used or not, we always want to be

ordered against dbus.socket if both are in the transaction. */

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 202

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+         r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER,

SPECIAL_DBUS_SOCKET, NULL, true);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 214

Quoted 12 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +12 -0
+Index: git/src/dbus1-generator/dbus1-generator.c
+===================================================================
+--- git.orig/src/dbus1-generator/dbus1-generator.c
++++ /dev/null
+@@ -1,331 +0,0 @@
+-/***
+-  This file is part of systemd.
+-
+-  Copyright 2013 Lennart Poettering
+-
+-  systemd is free software; you can redistribute it and/or modify it
+-  under the terms of the GNU Lesser General Public License as

published by

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 223

Quoted 9 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +9 -0
+-  the Free Software Foundation; either version 2.1 of the License, or
+-  (at your option) any later version.
+-
+-  systemd is distributed in the hope that it will be useful, but
+-  WITHOUT ANY WARRANTY; without even the implied warranty of
+-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-  Lesser General Public License for more details.
+-
+-  You should have received a copy of the GNU Lesser General Public

License

Quoted 38 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +38 -0
+-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-***/
+-
+-#include "alloc-util.h"
+-#include "bus-internal.h"
+-#include "bus-util.h"
+-#include "cgroup-util.h"
+-#include "conf-parser.h"
+-#include "dirent-util.h"
+-#include "fd-util.h"
+-#include "fileio.h"
+-#include "mkdir.h"
+-#include "special.h"
+-#include "unit-name.h"
+-#include "util.h"
+-
+-static const char *arg_dest_late = "/tmp", *arg_dest = "/tmp";
+-
+-static int create_dbus_files(
+-                const char *path,
+-                const char *name,
+-                const char *service,
+-                const char *exec,
+-                const char *user,
+-                const char *type) {
+-
+-        _cleanup_free_ char *b = NULL, *s = NULL, *lnk = NULL;
+-        _cleanup_fclose_ FILE *f = NULL;
+-        int r;
+-
+-        assert(path);
+-        assert(name);
+-        assert(service || exec);
+-
+-        if (!service) {
+-                _cleanup_free_ char *a = NULL;
+-
+-                s = strjoin("dbus-", name, ".service", NULL);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 271

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-                if (!s)
+-                        return log_oom();
+-
+-                a = strjoin(arg_dest_late, "/", s, NULL);
+-                if (!a)
+-                        return log_oom();
+-
+-                f = fopen(a, "wxe");
+-                if (!f)
+-                        return log_error_errno(errno, "Failed to

create %s: %m", a);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 274

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +3 -0
+-
+-                fprintf(f,
+-                        "# Automatically generated by

systemd-dbus1-generator\n\n"

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 278

Quoted 4 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +4 -0
+-                        "[Unit]\n"
+-                        "SourcePath=%s\n"
+-                        "Description=DBUS1: %s\n"
+-                        "Documentation=man:systemd-

dbus1-generator(8)\n\n"

Quoted 5 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +5 -0
+-                        "[Service]\n"
+-                        "ExecStart=%s\n"
+-                        "Type=dbus\n"
+-                        "BusName=%s\n",
+-                        path,

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 293

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-                        name,
+-                        exec,
+-                        name);
+-
+-                if (user)
+-                        fprintf(f, "User=%s\n", user);
+-
+-
+-                if (type) {
+-                        fprintf(f, "Environment=DBUS_STARTER_BUS_TYPE=%s\n",

type);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 296

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +3 -0
+-
+-                        if (streq(type, "system"))
+-                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS="

DEFAULT_SYSTEM_BUS_ADDRESS "\n");

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 302

Quoted 6 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +6 -0
+-                        else if (streq(type, "session")) {
+-                                char *run;
+-
+-                                run = getenv("XDG_RUNTIME_DIR");
+-                                if (!run) {
+-                                        log_error("XDG_RUNTIME_DIR not

set.");

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 306

Quoted 4 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +4 -0
+-                                        return -EINVAL;
+-                                }
+-
+-                                fprintf(f, "Environment=DBUS_STARTER_

ADDRESS="KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT "\n",

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 313

Quoted 7 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +7 -0
+-                                        getuid(), run);
+-                        }
+-                }
+-
+-                r = fflush_and_check(f);
+-                if (r < 0)
+-                        return log_error_errno(r, "Failed to write %s:

%m", a);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 326

Quoted 13 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +13 -0
+-
+-                f = safe_fclose(f);
+-
+-                service = s;
+-        }
+-
+-        b = strjoin(arg_dest_late, "/", name, ".busname", NULL);
+-        if (!b)
+-                return log_oom();
+-
+-        f = fopen(b, "wxe");
+-        if (!f)
+-                return log_error_errno(errno, "Failed to create %s:

%m", b);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 329

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +3 -0
+-
+-        fprintf(f,
+-                "# Automatically generated by

systemd-dbus1-generator\n\n"

Quoted 8 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +8 -0
+-                "[Unit]\n"
+-                "SourcePath=%s\n"
+-                "Description=DBUS1: %s\n"
+-                "Documentation=man:systemd-dbus1-generator(8)\n\n"
+-                "[BusName]\n"
+-                "Name=%s\n"
+-                "Service=%s\n"
+-                "AllowWorld=talk\n",

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 347

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-                path,
+-                name,
+-                name,
+-                service);
+-
+-        r = fflush_and_check(f);
+-        if (r < 0)
+-                return log_error_errno(r, "Failed to write %s: %m", b);
+-
+-        lnk = strjoin(arg_dest_late, "/" SPECIAL_BUSNAMES_TARGET

".wants/", name, ".busname", NULL);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 353

Quoted 6 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +6 -0
+-        if (!lnk)
+-                return log_oom();
+-
+-        mkdir_parents_label(lnk, 0755);
+-        if (symlink(b, lnk))
+-                return log_error_errno(errno, "Failed to create

symlink %s: %m", lnk);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 358

Quoted 5 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +5 -0
+-
+-        return 0;
+-}
+-
+-static int add_dbus(const char *path, const char *fname, const char

*type) {

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 359

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+-        _cleanup_free_ char *name = NULL, *exec = NULL, *user = NULL,

*service = NULL;

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 362

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +3 -0
+-
+-        const ConfigTableItem table[] = {
+-                { "D-BUS Service", "Name", config_parse_string, 0,

&name },

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 363

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+-                { "D-BUS Service", "Exec", config_parse_string, 0,

&exec },

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 364

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+-                { "D-BUS Service", "User", config_parse_string, 0,

&user },

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 365

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+-                { "D-BUS Service", "SystemdService",

config_parse_string, 0, &service },

Quoted 9 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +9 -0
+-                { },
+-        };
+-
+-        char *p;
+-        int r;
+-
+-        assert(path);
+-        assert(fname);
+-

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 384

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-        p = strjoina(path, "/", fname);
+-        r = config_parse(NULL, p, NULL,
+-                         "D-BUS Service\0",
+-                         config_item_table_lookup, table,
+-                         true, false, true, NULL);
+-        if (r < 0)
+-                return r;
+-
+-        if (!name) {
+-                log_warning("Activation file %s lacks name setting,

ignoring.", p);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 389

Quoted 5 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +5 -0
+-                return 0;
+-        }
+-
+-        if (!service_name_is_valid(name)) {
+-                log_warning("Bus service name %s is not valid,

ignoring.", name);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 399

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-                return 0;
+-        }
+-
+-        if (streq(name, "org.freedesktop.systemd1")) {
+-                log_debug("Skipping %s, identified as systemd.", p);
+-                return 0;
+-        }
+-
+-        if (service) {
+-                if (!unit_name_is_valid(service,

UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE)) {

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 400

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+-                        log_warning("Unit name %s is not valid,

ignoring.", service);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 404

Quoted 4 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +4 -0
+-                        return 0;
+-                }
+-                if (!endswith(service, ".service")) {
+-                        log_warning("Bus names can only activate

services, ignoring %s.", p);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 409

Quoted 5 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +5 -0
+-                        return 0;
+-                }
+-        } else {
+-                if (streq(exec, "/bin/false") || !exec) {
+-                        log_warning("Neither service name nor binary

path specified, ignoring %s.", p);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 414

Quoted 5 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +5 -0
+-                        return 0;
+-                }
+-
+-                if (exec[0] != '/') {
+-                        log_warning("Exec= in %s does not start with

an absolute path, ignoring.", p);

Quoted 11 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +11 -0
+-                        return 0;
+-                }
+-        }
+-
+-        return create_dbus_files(p, name, service, exec, user, type);
+-}
+-
+-static int parse_dbus_fragments(const char *path, const char *type) {
+-        _cleanup_closedir_ DIR *d = NULL;
+-        struct dirent *de;
+-        int r;

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 435

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-
+-        assert(path);
+-        assert(type);
+-
+-        d = opendir(path);
+-        if (!d) {
+-                if (errno == -ENOENT)
+-                        return 0;
+-
+-                return log_error_errno(errno, "Failed to enumerate

D-Bus activated services: %m");

Quoted 8 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +8 -0
+-        }
+-
+-        r = 0;
+-        FOREACH_DIRENT(de, d, goto fail) {
+-                int q;
+-
+-                if (!endswith(de->d_name, ".service"))
+-                        continue;

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 453

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-
+-                q = add_dbus(path, de->d_name, type);
+-                if (q < 0)
+-                        r = q;
+-        }
+-
+-        return r;
+-
+-fail:
+-        return log_error_errno(errno, "Failed to read D-Bus services

directory: %m");

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 460

Quoted 7 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +7 -0
+-}
+-
+-static int link_busnames_target(const char *units) {
+-        const char *f, *t;
+-
+-        f = strjoina(units, "/" SPECIAL_BUSNAMES_TARGET);
+-        t = strjoina(arg_dest, "/" SPECIAL_BASIC_TARGET ".wants/"

SPECIAL_BUSNAMES_TARGET);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 464

Quoted 4 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +4 -0
+-
+-        mkdir_parents_label(t, 0755);
+-        if (symlink(f, t) < 0)
+-                return log_error_errno(errno, "Failed to create

symlink %s: %m", t);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 476

Quoted 12 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +12 -0
+-
+-        return 0;
+-}
+-
+-static int link_compatibility(const char *units) {
+-        const char *f, *t;
+-
+-        f = strjoina(units, "/systemd-bus-proxyd.socket");
+-        t = strjoina(arg_dest, "/" SPECIAL_DBUS_SOCKET);
+-        mkdir_parents_label(t, 0755);
+-        if (symlink(f, t) < 0)
+-                return log_error_errno(errno, "Failed to create

symlink %s: %m", t);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 479

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +3 -0
+-
+-        f = strjoina(units, "/systemd-bus-proxyd.socket");
+-        t = strjoina(arg_dest, "/" SPECIAL_SOCKETS_TARGET

".wants/systemd-bus-proxyd.socket");

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 482

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +3 -0
+-        mkdir_parents_label(t, 0755);
+-        if (symlink(f, t) < 0)
+-                return log_error_errno(errno, "Failed to create

symlink %s: %m", t);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 486

Quoted 4 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +4 -0
+-
+-        t = strjoina(arg_dest, "/" SPECIAL_DBUS_SERVICE);
+-        if (symlink("/dev/null", t) < 0)
+-                return log_error_errno(errno, "Failed to mask %s: %m",

t);

Quoted 28 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +28 -0
+-
+-        return 0;
+-}
+-
+-int main(int argc, char *argv[]) {
+-        const char *path, *type, *units;
+-        int r, q;
+-
+-        if (argc > 1 && argc != 4) {
+-                log_error("This program takes three or no arguments.");
+-                return EXIT_FAILURE;
+-        }
+-
+-        if (argc > 1) {
+-                arg_dest = argv[1];
+-                arg_dest_late = argv[3];
+-        }
+-
+-        log_set_target(LOG_TARGET_SAFE);
+-        log_parse_environment();
+-        log_open();
+-
+-        umask(0022);
+-
+-        if (!is_kdbus_available())
+-                return 0;
+-
+-        r = cg_pid_get_owner_uid(0, NULL);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 524

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-        if (r >= 0) {
+-                path = "/usr/share/dbus-1/services";
+-                type = "session";
+-                units = USER_DATA_UNIT_PATH;
+-        } else if (r == -ENXIO) {
+-                path = "/usr/share/dbus-1/system-services";
+-                type = "system";
+-                units = SYSTEM_DATA_UNIT_PATH;
+-        } else
+-                return log_error_errno(r, "Failed to determine whether

we are running as user or system instance: %m");

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 528

Quoted 4 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +4 -0
+-
+-        r = parse_dbus_fragments(path, type);
+-
+-        /* FIXME: One day this should just be pulled in statically

from basic.target */

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-        q = link_busnames_target(units);
+-        if (q < 0)
+-                r = q;
+-
+-        q = link_compatibility(units);
+-        if (q < 0)
+-                r = q;
+-
+-        return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+-}

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 548

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+Index: git/src/login/pam_systemd.c
+===================================================================
+--- git.orig/src/login/pam_systemd.c
++++ git/src/login/pam_systemd.c
+@@ -182,25 +182,20 @@ static int export_legacy_dbus_address(
+         _cleanup_free_ char *s = NULL;
+         int r = PAM_BUF_ERR;
+
+-        if (is_kdbus_available()) {
+-                if (asprintf(&s, KERNEL_USER_BUS_ADDRESS_FMT ";"

UNIX_USER_BUS_ADDRESS_FMT, uid, runtime) < 0)

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 551

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +3 -0
+-                        goto error;
+-        } else {
+-                /* FIXME: We *really* should move the access() check

into the

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-                 * daemons that spawn dbus-daemon, instead of forcing
+-                 * DBUS_SESSION_BUS_ADDRESS= here. */
++        /* FIXME: We *really* should move the access() check into the
++         * daemons that spawn dbus-daemon, instead of forcing
++         * DBUS_SESSION_BUS_ADDRESS= here. */
+
+-                s = strjoin(runtime, "/bus", NULL);
+-                if (!s)
+-                        goto error;
++        s = strjoin(runtime, "/bus", NULL);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 571

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
++        if (!s)
++                goto error;
+
+-                if (access(s, F_OK) < 0)
+-                        return PAM_SUCCESS;
++        if (access(s, F_OK) < 0)
++                return PAM_SUCCESS;
+
+-                s = mfree(s);
+-                if (asprintf(&s, UNIX_USER_BUS_ADDRESS_FMT, runtime) <

0)

Quoted 29 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +29 -0
+-                        goto error;
+-        }
++        s = mfree(s);
++        if (asprintf(&s, UNIX_USER_BUS_ADDRESS_FMT, runtime) < 0)
++                goto error;
+
+         r = pam_misc_setenv(handle, "DBUS_SESSION_BUS_ADDRESS", s, 0);
+         if (r != PAM_SUCCESS)
+Index: git/src/shared/bus-util.c
+===================================================================
+--- git.orig/src/shared/bus-util.c
++++ git/src/shared/bus-util.c
+@@ -1492,40 +1492,6 @@ int bus_path_decode_unique(const char *p
+         return 1;
+ }
+
+-bool is_kdbus_wanted(void) {
+-        _cleanup_free_ char *value = NULL;
+-#ifdef ENABLE_KDBUS
+-        const bool configured = true;
+-#else
+-        const bool configured = false;
+-#endif
+-
+-        int r;
+-
+-        if (get_proc_cmdline_key("kdbus", NULL) > 0)
+-                return true;
+-

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 610

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-        r = get_proc_cmdline_key("kdbus=", &value);
+-        if (r <= 0)
+-                return configured;
+-
+-        return parse_boolean(value) == 1;
+-}
+-
+-bool is_kdbus_available(void) {
+-        _cleanup_close_ int fd = -1;
+-        struct kdbus_cmd cmd = { .size = sizeof(cmd), .flags =

KDBUS_FLAG_NEGOTIATE };

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 615

Quoted 5 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +5 -0
+-
+-        if (!is_kdbus_wanted())
+-                return false;
+-
+-        fd = open("/sys/fs/kdbus/control", O_RDWR | O_CLOEXEC |

O_NONBLOCK | O_NOCTTY);

Quoted 5 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +5 -0
+-        if (fd < 0)
+-                return false;
+-
+-        return ioctl(fd, KDBUS_CMD_BUS_MAKE, &cmd) >= 0;
+-}

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 630

Quoted 10 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +10 -0
+-
+ int bus_property_get_rlimit(
+                 sd_bus *bus,
+                 const char *path,
+Index: git/src/shared/bus-util.h
+===================================================================
+--- git.orig/src/shared/bus-util.h
++++ git/src/shared/bus-util.h
+@@ -157,7 +157,4 @@ int bus_log_create_error(int r);
+ int bus_path_encode_unique(sd_bus *b, const char *prefix, const char

*sender_id, const char *external_id, char **ret_path);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 631

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+ int bus_path_decode_unique(const char *path, const char *prefix, char

**ret_sender, char **ret_external);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 636

Quoted 5 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +5 -0
+
+-bool is_kdbus_wanted(void);
+-bool is_kdbus_available(void);
+-
+ int bus_property_get_rlimit(sd_bus *bus, const char *path, const char

*interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 644

Quoted 8 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +8 -0
+Index: git/Makefile.am
+===================================================================
+--- git.orig/Makefile.am
++++ git/Makefile.am
+@@ -2895,29 +2895,9 @@ systemd_gpt_auto_generator_CFLAGS = \
+ endif
+
+ # ------------------------------------------------------------

------------------

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 656

Quoted 12 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +12 -0
+-systemgenerator_PROGRAMS +=  \
+-      systemd-dbus1-generator
+-
+-systemd_dbus1_generator_SOURCES = \
+-      src/dbus1-generator/dbus1-generator.c
+-
+-systemd_dbus1_generator_LDADD = \
+-      libshared.la
+-
+-dbus1-generator-install-hook:
+-      $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(usergeneratordir)
+-      $(AM_V_RM)rm -f $(DESTDIR)$(usergeneratordir)/

systemd-dbus1-generator

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 657

Quoted 1 line
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +1 -0
+-      $(AM_V_LN)lnr $(DESTDIR)$(systemgeneratordir)/systemd-dbus1-generator

$(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator

meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- line 668

Quoted 11 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +11 -0
+-
+-dbus1-generator-uninstall-hook:
+-      rm -f $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
+-
+ dist_xinitrc_SCRIPTS = \
+       xorg/50-systemd-user.sh
+
+-INSTALL_EXEC_HOOKS += dbus1-generator-install-hook
+-UNINSTALL_EXEC_HOOKS += dbus1-generator-uninstall-hook
+-
+ # ------------------------------------------------------------

------------------

Review

Quoted 3 lines
meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t- new file +2 -0
+ systemd_sysv_generator_SOURCES = \
+       src/sysv-generator/sysv-generator.c
(quoted diff) +0 -0

b/meta/recipes-core/systemd/systemd_230.bb

meta/recipes-core/systemd/systemd_230.bb SRC_URI += " \ · line 43

Quoted 11 lines

index 40f1428..f4ff860 100644

meta/recipes-core/systemd/systemd_230.bb +1 -0
@@ -37,6 +37,7 @@ SRC_URI += " \
            file://udev-re-enable-mount-propagation-for-udevd.patch \
            file://CVE-2016-7795.patch \
            file://validate-user.patch \
+           file://Ensure-kdbus-isn-t-used-3501.patch \
 "
 SRC_URI_append_libc-uclibc = "\
            file://0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch

\

meta/recipes-core/systemd/systemd_230.bb PACKAGECONFIG[timedated] =

Quoted 9 lines
meta/recipes-core/systemd/systemd_230.bb +0 -1
@@ -61,7 +62,6 @@ PACKAGECONFIG ??= "xz \
                    timedated \
                    timesyncd \
                    localed \
-                   kdbus \
                    ima \
                    smack \
                    logind \
@@ -96,7 +96,6 @@ PACKAGECONFIG[timedated] =

"--enable-timedated,--disable-timedated"

Quoted 10 lines
meta/recipes-core/systemd/systemd_230.bb +0 -2
 PACKAGECONFIG[timesyncd] = "--enable-timesyncd,--disable-timesyncd"
 PACKAGECONFIG[localed] = "--enable-localed,--disable-localed"
 PACKAGECONFIG[efi] = "--enable-efi,--disable-efi"
-PACKAGECONFIG[kdbus] = "--enable-kdbus,--disable-kdbus"
 PACKAGECONFIG[ima] = "--enable-ima,--disable-ima"
 PACKAGECONFIG[smack] = "--enable-smack,--disable-smack"
 # libseccomp is found in meta-security
--

2.7.4

Quoted 5 lines

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core