]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-image: insist that the architecture matches if both root and /usr partitions...
authorLennart Poettering <lennart@poettering.net>
Thu, 9 Sep 2021 09:24:44 +0000 (11:24 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Sep 2021 12:15:36 +0000 (14:15 +0200)
src/shared/dissect-image.c

index 00ac8c694075efbf51fcba1c4e8bcf7645432e2f..566c073c29a0469767ac68e2e43fcf30c73f8b7e 100644 (file)
@@ -1337,6 +1337,14 @@ int dissect_image(
         } else if (m->partitions[PARTITION_USR_SECONDARY_VERITY].found)
                 return -EADDRNOTAVAIL; /* as above */
 
+        /* If root and /usr are combined then insist that the architecture matches */
+        if (m->partitions[PARTITION_ROOT].found &&
+            m->partitions[PARTITION_USR].found &&
+            (m->partitions[PARTITION_ROOT].architecture >= 0 &&
+             m->partitions[PARTITION_USR].architecture >= 0 &&
+             m->partitions[PARTITION_ROOT].architecture != m->partitions[PARTITION_USR].architecture))
+                return -EADDRNOTAVAIL;
+
         if (!m->partitions[PARTITION_ROOT].found &&
             !m->partitions[PARTITION_USR].found &&
             (flags & DISSECT_IMAGE_GENERIC_ROOT) &&