summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-09-17 17:32:34 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-20 12:43:41 +0200
commitb6efbbfb001a41c4e74a716f73c67abe8250594e (patch)
tree6bb261026969a4e8e8aec60a28be556b8773ccfa
parentdc5c5cd5c864aaae8c2695c2b833d556d8df0f98 (diff)
downloadsystemd-b6efbbfb001a41c4e74a716f73c67abe8250594e.tar.gz
dissect: always invalidate secondary arch partitions if we found primary arch
Let's suppress the secondary arch data, since we never ever want to mount it if we found the primary arch. Previously we only suppressed in the Verity case, but there's little reason to entertain the idea of a secondary arch in non-Verity environments either, we are not going to use them, and should not do decryption or anything like that. (cherry picked from commit 74cb2db9f403dfe17cabc6dac48b0f49a84eb03f) (cherry picked from commit 418cf0e78c067f7249f4769f78c8c199d907935f) (cherry picked from commit 7f2b6a50d3c47da8a697f50c0bc191902ebec069)
-rw-r--r--src/shared/dissect-image.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
index e1fcb371c1..29b72e7375 100644
--- a/src/shared/dissect-image.c
+++ b/src/shared/dissect-image.c
@@ -671,7 +671,12 @@ int dissect_image(
}
}
- if (!m->partitions[PARTITION_ROOT].found) {
+ if (m->partitions[PARTITION_ROOT].found) {
+ /* If we found the primary arch, then invalidate the secondary arch to avoid any ambiguities,
+ * since we never want to mount the secondary arch in this case. */
+ m->partitions[PARTITION_ROOT_SECONDARY].found = false;
+ m->partitions[PARTITION_ROOT_SECONDARY_VERITY].found = false;
+ } else {
/* No root partition found? Then let's see if ther's one for the secondary architecture. And if not
* either, then check if there's a single generic one, and use that. */
@@ -716,12 +721,6 @@ int dissect_image(
if (!m->partitions[PARTITION_ROOT_VERITY].found || !m->partitions[PARTITION_ROOT].found)
return -EADDRNOTAVAIL;
- /* If we found the primary root with the hash, then we definitely want to suppress any secondary root
- * (which would be weird, after all the root hash should only be assigned to one pair of
- * partitions... */
- m->partitions[PARTITION_ROOT_SECONDARY].found = false;
- m->partitions[PARTITION_ROOT_SECONDARY_VERITY].found = false;
-
/* If we found a verity setup, then the root partition is necessarily read-only. */
m->partitions[PARTITION_ROOT].rw = false;