aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/Ensure-kdbus-isn-t-used-3501.patch
blob: d08a10fad616eac08f3dd8db5854c84defe61d2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
From 222953e87f34545a3f9c6d3c18216e222bf6ea94 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
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 <akuster@mvista.com>

---
 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