Skip to content
This repository was archived by the owner on Nov 15, 2025. It is now read-only.

Commit 74cb2db

Browse files
committed
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.
1 parent 2204317 commit 74cb2db

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/shared/dissect-image.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,12 @@ int dissect_image(
793793
}
794794
}
795795

796-
if (!m->partitions[PARTITION_ROOT].found) {
796+
if (m->partitions[PARTITION_ROOT].found) {
797+
/* If we found the primary arch, then invalidate the secondary arch to avoid any ambiguities,
798+
* since we never want to mount the secondary arch in this case. */
799+
m->partitions[PARTITION_ROOT_SECONDARY].found = false;
800+
m->partitions[PARTITION_ROOT_SECONDARY_VERITY].found = false;
801+
} else {
797802
/* No root partition found? Then let's see if ther's one for the secondary architecture. And if not
798803
* either, then check if there's a single generic one, and use that. */
799804

@@ -848,12 +853,6 @@ int dissect_image(
848853
if (!m->partitions[PARTITION_ROOT_VERITY].found || !m->partitions[PARTITION_ROOT].found)
849854
return -EADDRNOTAVAIL;
850855

851-
/* If we found the primary root with the hash, then we definitely want to suppress any secondary root
852-
* (which would be weird, after all the root hash should only be assigned to one pair of
853-
* partitions... */
854-
m->partitions[PARTITION_ROOT_SECONDARY].found = false;
855-
m->partitions[PARTITION_ROOT_SECONDARY_VERITY].found = false;
856-
857856
/* If we found a verity setup, then the root partition is necessarily read-only. */
858857
m->partitions[PARTITION_ROOT].rw = false;
859858

0 commit comments

Comments
 (0)