]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/manager: add unmerged-bin taint 32438/head
authorMike Yuan <me@yhndnzj.com>
Tue, 23 Apr 2024 14:33:10 +0000 (22:33 +0800)
committerMike Yuan <me@yhndnzj.com>
Wed, 24 Apr 2024 00:43:08 +0000 (08:43 +0800)
catalog/systemd.catalog.in
man/org.freedesktop.systemd1.xml
src/core/manager.c

index 3bf9b6cffbc336f61964328f4bb83cf6f06e25f5..f0fc62dd8551c567061ad747b96ca4d3fd73ca71 100644 (file)
@@ -560,6 +560,7 @@ Support: %SUPPORT_URL%
 The following "tags" are possible:
 - "unmerged-usr" - /bin, /sbin, /lib* are not symlinks to their counterparts
   under /usr/
+- "unmerged-bin" - /usr/sbin is not a symlink to /usr/bin/
 - "var-run-bad" — /var/run is not a symlink to /run/
 - "cgroupsv1" - the system is using the deprecated cgroup v1 hierarchy
 - "local-hwclock" - the local hardware clock (RTC) is configured to be in
index 1c5b7d38f5cb1a389428fd7cea69fa87668cd238..749e6e3653efcd7d5aaddc5a821ebcfcaac4dfa7 100644 (file)
@@ -1667,6 +1667,15 @@ node /org/freedesktop/systemd1 {
           <xi:include href="version-info.xml" xpointer="v252"/></listitem>
         </varlistentry>
 
+        <varlistentry>
+          <term><literal>unmerged-bin</literal></term>
+
+          <listitem><para><filename>/usr/sbin</filename> is not a symlink to <filename>/usr/bin/</filename>.
+          </para>
+
+          <xi:include href="version-info.xml" xpointer="v256"/></listitem>
+        </varlistentry>
+
         <varlistentry>
           <term><literal>var-run-bad</literal></term>
 
index 35e08e5f77168e1a3e08ab24410a182df810abf4..ebaf33bc5f69afb9ec9ecaa61d20e7029c6b9a05 100644 (file)
@@ -4836,7 +4836,7 @@ static int short_uid_range(const char *path) {
 }
 
 char* manager_taint_string(const Manager *m) {
-        const char *stage[11] = {};
+        const char *stage[12] = {};
         size_t n = 0;
 
         /* Returns a "taint string", e.g. "local-hwclock:var-run-bad". Only things that are detected at
@@ -4845,13 +4845,17 @@ char* manager_taint_string(const Manager *m) {
 
         assert(m);
 
-        _cleanup_free_ char *usrbin = NULL;
-        if (readlink_malloc("/bin", &usrbin) < 0 || !PATH_IN_SET(usrbin, "usr/bin", "/usr/bin"))
+        _cleanup_free_ char *bin = NULL, *usr_sbin = NULL, *var_run = NULL;
+
+        if (readlink_malloc("/bin", &bin) < 0 || !PATH_IN_SET(bin, "usr/bin", "/usr/bin"))
                 stage[n++] = "unmerged-usr";
 
-        _cleanup_free_ char *destination = NULL;
-        if (readlink_malloc("/var/run", &destination) < 0 ||
-            !PATH_IN_SET(destination, "../run", "/run"))
+        /* Note that the check is different from default_PATH(), as we want to taint on uncanonical symlinks
+         * too. */
+        if (readlink_malloc("/usr/sbin", &usr_sbin) < 0 || !PATH_IN_SET(usr_sbin, "bin", "/usr/bin"))
+                stage[n++] = "unmerged-bin";
+
+        if (readlink_malloc("/var/run", &var_run) < 0 || !PATH_IN_SET(var_run, "../run", "/run"))
                 stage[n++] = "var-run-bad";
 
         if (cg_all_unified() == 0)