]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
selinux: improve comment about getcon_raw semantics
authorAxel Rasmussen <axelrasmussen@google.com>
Mon, 3 Aug 2020 16:19:49 +0000 (09:19 -0700)
committerLennart Poettering <lennart@poettering.net>
Wed, 5 Aug 2020 18:20:45 +0000 (20:20 +0200)
This code was changed in this pull request:
https://github.com/systemd/systemd/pull/16571

After some discussion and more investigation, we better understand
what's going on. So, update the comment, so things are more clear
to future readers.

src/core/selinux-setup.c

index 817069b3fe616e09ffa38516e1b591c205bfbbb2..40da8dd0e5c03e5df34135c71764863265dcfa92 100644 (file)
@@ -50,7 +50,10 @@ int mac_selinux_setup(bool *loaded_policy) {
 
         /* Already initialized by somebody else? */
         r = getcon_raw(&con);
-        /* getcon_raw can return 0, and still give us a NULL pointer. */
+        /* getcon_raw can return 0, and still give us a NULL pointer if
+         * /proc/self/attr/current is empty. SELinux guarantees this won't
+         * happen, but that file isn't specific to SELinux, and may be provided
+         * by some other arbitrary LSM with different semantics. */
         if (r == 0 && con) {
                 initialized = !streq(con, "kernel");
                 freecon(con);