image-info: mount partitions in correct order when analysing image

image-info's code which analysed image with multiple partitions was not
correctly working with more than two partitions, which had to be the
root '/' and EFI partition '/boot/efi'. The consequence was that SELinux
labels on paths which were mounted incorrectly could have been reported
as incorrect.

Modify `append_partitions()` to first read the fstab entries and then
mount all partitions using their UUID in the correct order. Only then
analyze the image filesystem tree.

Regenerate affected image test cases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2021-08-02 16:35:09 +02:00 committed by Ondřej Budai
parent 972515ad84
commit aed3bf785c
3 changed files with 36 additions and 75 deletions

View file

@ -10795,7 +10795,6 @@
},
"rpm-verify": {
"changed": {
"/boot": ".M.......",
"/etc/chrony.conf": "S.5....T.",
"/etc/dnf/plugins/product-id.conf": "..5....T.",
"/etc/dnf/plugins/subscription-manager.conf": "..5....T.",
@ -10814,34 +10813,9 @@
"/var/spool/anacron/cron.monthly": ".M.......",
"/var/spool/anacron/cron.weekly": ".M......."
},
"missing": [
"/boot/efi",
"/boot/efi/EFI",
"/boot/efi/EFI/BOOT",
"/boot/efi/EFI/BOOT/BOOTAA64.EFI",
"/boot/efi/EFI/BOOT/fbaa64.efi",
"/boot/efi/EFI/redhat",
"/boot/efi/EFI/redhat",
"/boot/efi/EFI/redhat/BOOTAA64.CSV",
"/boot/efi/EFI/redhat/fonts",
"/boot/efi/EFI/redhat/grubaa64.efi",
"/boot/efi/EFI/redhat/mmaa64.efi",
"/boot/efi/EFI/redhat/shim.efi",
"/boot/efi/EFI/redhat/shimaa64-redhat.efi",
"/boot/efi/EFI/redhat/shimaa64.efi",
"/boot/grub2",
"/boot/grub2/grubenv",
"/boot/loader/entries"
]
"missing": []
},
"selinux": {
"context-mismatch": [
{
"actual": "unconfined_u:object_r:unlabeled_t:s0",
"expected": "system_u:object_r:boot_t:s0",
"filename": "/boot"
}
],
"policy": {
"SELINUX": "enforcing",
"SELINUXTYPE": "targeted"

View file

@ -10835,7 +10835,6 @@
},
"rpm-verify": {
"changed": {
"/boot": ".M.......",
"/etc/chrony.conf": "S.5....T.",
"/etc/dnf/plugins/product-id.conf": "..5....T.",
"/etc/dnf/plugins/subscription-manager.conf": "..5....T.",
@ -10857,34 +10856,10 @@
"/var/spool/anacron/cron.weekly": ".M......."
},
"missing": [
"/boot/efi",
"/boot/efi/EFI",
"/boot/efi/EFI/BOOT",
"/boot/efi/EFI/BOOT/BOOTAA64.EFI",
"/boot/efi/EFI/BOOT/fbaa64.efi",
"/boot/efi/EFI/redhat",
"/boot/efi/EFI/redhat",
"/boot/efi/EFI/redhat/BOOTAA64.CSV",
"/boot/efi/EFI/redhat/fonts",
"/boot/efi/EFI/redhat/grubaa64.efi",
"/boot/efi/EFI/redhat/mmaa64.efi",
"/boot/efi/EFI/redhat/shim.efi",
"/boot/efi/EFI/redhat/shimaa64-redhat.efi",
"/boot/efi/EFI/redhat/shimaa64.efi",
"/boot/grub2",
"/boot/grub2/grubenv",
"/boot/loader/entries",
"/etc/yum.repos.d/redhat-rhui.repo"
]
},
"selinux": {
"context-mismatch": [
{
"actual": "unconfined_u:object_r:unlabeled_t:s0",
"expected": "system_u:object_r:boot_t:s0",
"filename": "/boot"
}
],
"policy": {
"SELINUX": "enforcing",
"SELINUXTYPE": "targeted"