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

Commit 418cf0e

Browse files
poetteringkeszybz
authored andcommitted
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 74cb2db)
1 parent 1d17c00 commit 418cf0e

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
@@ -770,7 +770,12 @@ int dissect_image(
770770
}
771771
}
772772

773-
if (!m->partitions[PARTITION_ROOT].found) {
773+
if (m->partitions[PARTITION_ROOT].found) {
774+
/* If we found the primary arch, then invalidate the secondary arch to avoid any ambiguities,
775+
* since we never want to mount the secondary arch in this case. */
776+
m->partitions[PARTITION_ROOT_SECONDARY].found = false;
777+
m->partitions[PARTITION_ROOT_SECONDARY_VERITY].found = false;
778+
} else {
774779
/* No root partition found? Then let's see if ther's one for the secondary architecture. And if not
775780
* either, then check if there's a single generic one, and use that. */
776781

@@ -815,12 +820,6 @@ int dissect_image(
815820
if (!m->partitions[PARTITION_ROOT_VERITY].found || !m->partitions[PARTITION_ROOT].found)
816821
return -EADDRNOTAVAIL;
817822

818-
/* If we found the primary root with the hash, then we definitely want to suppress any secondary root
819-
* (which would be weird, after all the root hash should only be assigned to one pair of
820-
* partitions... */
821-
m->partitions[PARTITION_ROOT_SECONDARY].found = false;
822-
m->partitions[PARTITION_ROOT_SECONDARY_VERITY].found = false;
823-
824823
/* If we found a verity setup, then the root partition is necessarily read-only. */
825824
m->partitions[PARTITION_ROOT].rw = false;
826825

0 commit comments

Comments
 (0)