]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: make mount(8) and swapon(8) inherit SMACK label from systemd
authorŁukasz Stelmach <l.stelmach@samsung.com>
Tue, 29 Oct 2024 14:53:45 +0000 (15:53 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 13 Nov 2024 19:48:10 +0000 (19:48 +0000)
By default mount(8), umount(8), swapon(8) and swapoff(8) should run with
with the SMACK label inherited from systemd rather than the default one
meant for services.

Fixes: aa5ae9711ef3cd0c69b7fcfbd65bca05fb704a8a
Follow-up-for: 20bbf5ee4c6c80599a91e7a4b7474e931a27db4a
(cherry picked from commit 8144537a81c7a815af3d4c63cd8545ee17b2715d)

src/core/mount.c
src/core/swap.c

index 942495fb19aa29cf9e7cf06d1addb0bdc7a08fa7..66917dfa88b87ae5e5d69d64bd590c1708dafe35 100644 (file)
@@ -895,6 +895,9 @@ static int mount_spawn(Mount *m, ExecCommand *c, PidRef *ret_pid) {
         if (r < 0)
                 return r;
 
+        /* Assume the label inherited from systemd as the fallback */
+        exec_params.fallback_smack_process_label = NULL;
+
         r = exec_spawn(UNIT(m),
                        c,
                        &m->exec_context,
index c4d2ba8f3acb5aa7395105f966cf95ae7008212d..c89a723a4be70bf94ef1019498547a49a3f981f9 100644 (file)
@@ -647,6 +647,9 @@ static int swap_spawn(Swap *s, ExecCommand *c, PidRef *ret_pid) {
         if (r < 0)
                 return r;
 
+        /* Assume the label inherited from systemd as the fallback */
+        exec_params.fallback_smack_process_label = NULL;
+
         r = exec_spawn(UNIT(s),
                        c,
                        &s->exec_context,