summaryrefslogtreecommitdiffstats
path: root/meta-app-framework/recipes-core/systemd
diff options
context:
space:
mode:
Diffstat (limited to 'meta-app-framework/recipes-core/systemd')
-rw-r--r--meta-app-framework/recipes-core/systemd/systemd/0001-Switch-Smack-label-earlier.patch52
-rw-r--r--meta-app-framework/recipes-core/systemd/systemd_2%.bbappend1
-rw-r--r--meta-app-framework/recipes-core/systemd/systemd_appfw.inc40
3 files changed, 93 insertions, 0 deletions
diff --git a/meta-app-framework/recipes-core/systemd/systemd/0001-Switch-Smack-label-earlier.patch b/meta-app-framework/recipes-core/systemd/systemd/0001-Switch-Smack-label-earlier.patch
new file mode 100644
index 000000000..46445be73
--- /dev/null
+++ b/meta-app-framework/recipes-core/systemd/systemd/0001-Switch-Smack-label-earlier.patch
@@ -0,0 +1,52 @@
+From 6cc74075797edb6f698cb7f312bb1c3d8cc6cb28 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
+Date: Thu, 12 Oct 2017 17:17:56 +0200
+Subject: [PATCH] Switch Smack label earlier
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Switching label after removing capability isn't
+possible.
+
+Change-Id: Ib7dac8f071f36119520ed3205d743c1e3df3cd5e
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ src/core/execute.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/src/core/execute.c b/src/core/execute.c
+index d72e5bf08..0abffd569 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -2707,6 +2707,13 @@ static int exec_child(
+ }
+ }
+
++ r = setup_smack(context, command);
++ if (r < 0) {
++ *exit_status = EXIT_SMACK_PROCESS_LABEL;
++ *error_message = strdup("Failed to set SMACK process label");
++ return r;
++ }
++
+ if (!cap_test_all(context->capability_bounding_set)) {
+ r = capability_bounding_set_drop(context->capability_bounding_set, false);
+ if (r < 0) {
+@@ -2775,13 +2782,6 @@ static int exec_child(
+ }
+ #endif
+
+- r = setup_smack(context, command);
+- if (r < 0) {
+- *exit_status = EXIT_SMACK_PROCESS_LABEL;
+- *error_message = strdup("Failed to set SMACK process label");
+- return r;
+- }
+-
+ #ifdef HAVE_APPARMOR
+ if (context->apparmor_profile && mac_apparmor_use()) {
+ r = aa_change_onexec(context->apparmor_profile);
+--
+2.14.3
+
diff --git a/meta-app-framework/recipes-core/systemd/systemd_2%.bbappend b/meta-app-framework/recipes-core/systemd/systemd_2%.bbappend
new file mode 100644
index 000000000..11b1df9bb
--- /dev/null
+++ b/meta-app-framework/recipes-core/systemd/systemd_2%.bbappend
@@ -0,0 +1 @@
+require ${@bb.utils.contains('APPFW_ENABLED', '1', 'systemd_appfw.inc', '', d)}
diff --git a/meta-app-framework/recipes-core/systemd/systemd_appfw.inc b/meta-app-framework/recipes-core/systemd/systemd_appfw.inc
new file mode 100644
index 000000000..a5e1ae840
--- /dev/null
+++ b/meta-app-framework/recipes-core/systemd/systemd_appfw.inc
@@ -0,0 +1,40 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/systemd:"
+
+# Ensures systemd runs with label "System"
+EXTRA_OEMESON_append_with-lsm-smack = " -Dsmack-run-label=System"
+
+##################################################################################
+# Maintaining trivial, non-upstreamable configuration changes as patches
+# is tedious. But in same cases (like early mounting of special directories)
+# the configuration has to be in code. We make these changes here directly.
+##################################################################################
+do_patch[prefuncs] += "patch_systemd"
+do_patch[vardeps] += "patch_systemd"
+patch_systemd() {
+ # Handling of /run and /sys/fs/cgroup. Make /run a transmuting directory to
+ # enable systemd communications with services in the User domain.
+ # Original patch by Michael Demeter <michael.demeter@intel.com>.
+ #
+ # We simplify the patching by touching only lines which check the result of
+ # mac_smack_use(). Those are the ones which are used when Smack is active.
+ #
+ # smackfsroot=* on /sys/fs/cgroup may be upstreamable, but smackfstransmute=System::Run
+ # is too distro specific (depends on Smack rules) and thus has to remain here.
+ sed -i -e 's;\("/sys/fs/cgroup", *"[^"]*", *"[^"]*\)\(.*mac_smack_use.*\);\1,smackfsroot=*\2;' \
+ -e 's;\("/run", *"[^"]*", *"[^"]*\)\(.*mac_smack_use.*\);\1,smackfstransmute=System::Run\2;' \
+ ${S}/src/core/mount-setup.c
+}
+
+##################################################################################
+# What follows is temporary.
+# This is a solution to the Bug-AGL SPEC-539
+# (see https://jira.automotivelinux.org/browse/SPEC-539).
+#
+# It renames the file "touchscreen.rules" to "55-touchscreen.rules"
+# This comes with the recipe systemd_230/234 of poky (meta/recipes-core/systemd)
+# It should be removed when poky changes.
+##################################################################################
+do_install_prepend() {
+ mv ${WORKDIR}/touchscreen.rules ${WORKDIR}/55-touchscreen.rules || true
+}
+