diff options
Diffstat (limited to 'meta-oe/recipes-core/dbus/dbus-broker/0006-launch-policy-fix-crash-when-exporting-selinux.patch')
-rw-r--r-- | meta-oe/recipes-core/dbus/dbus-broker/0006-launch-policy-fix-crash-when-exporting-selinux.patch | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/dbus/dbus-broker/0006-launch-policy-fix-crash-when-exporting-selinux.patch b/meta-oe/recipes-core/dbus/dbus-broker/0006-launch-policy-fix-crash-when-exporting-selinux.patch new file mode 100644 index 000000000..51f45361b --- /dev/null +++ b/meta-oe/recipes-core/dbus/dbus-broker/0006-launch-policy-fix-crash-when-exporting-selinux.patch | |||
@@ -0,0 +1,59 @@ | |||
1 | From f1cdef4d98ddbfeeb4a688712d54b3adc89bfe26 Mon Sep 17 00:00:00 2001 | ||
2 | From: Luca Boccassi <luca.boccassi@microsoft.com> | ||
3 | Date: Fri, 25 Oct 2019 21:05:43 +0100 | ||
4 | Subject: [PATCH 2/2] launch/policy: fix crash when exporting <selinux> | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | If a policy contains a <selinux> element, dbus-broker-launch crashes: | ||
10 | |||
11 | [ 30.048705] dbus-broker-launch[221]: ERROR policy_export @ ../dbus-broker-21/src/launch/policy.c +1142: Return code 1 | ||
12 | [ 30.050963] dbus-broker-launch[221]: launcher_add_listener @ ../dbus-broker-21/src/launch/launcher.c +1130 | ||
13 | [ 30.079620] dbus-broker[228]: Dispatched 0 messages @ 0(±0)μs / message. | ||
14 | [ 30.082613] dbus-broker-launch[221]: launcher_run @ ../dbus-broker-21/src/launch/launcher.c +1389 | ||
15 | [ 30.084426] dbus-broker-launch[221]: run @ ../dbus-broker-21/src/launch/main.c +153 | ||
16 | [ 30.085797] dbus-broker-launch[221]: main @ ../dbus-broker-21/src/launch/main.c +181 | ||
17 | [ 30.087208] dbus-broker-launch[221]: Exiting due to fatal error: -131 | ||
18 | |||
19 | Minimal config to reproduce: | ||
20 | |||
21 | <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | ||
22 | "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
23 | <busconfig> | ||
24 | <selinux> | ||
25 | <associate own="com.example1" context="system_u:object_r:example1_t" /> | ||
26 | <associate own="com.example2" context="system_u:object_r:example2_t" /> | ||
27 | </selinux> | ||
28 | </busconfig> | ||
29 | |||
30 | As per the libsystemd API, sd_bus_message_append can return an int | ||
31 | greater than 0 on success, which for example happens when processing | ||
32 | vectors. | ||
33 | The export function is treating every non-zero result as an error, | ||
34 | which causes dbus-broker-launch to terminate. | ||
35 | |||
36 | Fixes #212 | ||
37 | |||
38 | Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> | ||
39 | Upstream-Status: merged https://github.com/bus1/dbus-broker/pull/213 | ||
40 | --- | ||
41 | src/launch/policy.c | 2 +- | ||
42 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
43 | |||
44 | diff --git a/src/launch/policy.c b/src/launch/policy.c | ||
45 | index 466e4bd..f91f11b 100644 | ||
46 | --- a/src/launch/policy.c | ||
47 | +++ b/src/launch/policy.c | ||
48 | @@ -1138,7 +1138,7 @@ int policy_export(Policy *policy, sd_bus_message *m, uint32_t *at_console_uids, | ||
49 | r = sd_bus_message_append(m, "(ss)", | ||
50 | i_record->selinux.name, | ||
51 | i_record->selinux.context); | ||
52 | - if (r) | ||
53 | + if (r < 0) | ||
54 | return error_origin(r); | ||
55 | } | ||
56 | |||
57 | -- | ||
58 | 2.20.1 | ||
59 | |||