]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(fips): do not blindly remove /boot
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Wed, 23 Nov 2022 13:22:21 +0000 (14:22 +0100)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Mon, 13 Feb 2023 12:00:01 +0000 (12:00 +0000)
The `mount_boot` method called from fips-noboot.sh in the pre-pivot hook blindly
executes `rm -rf /boot` if there is no `boot=` command line parameter, without
first checking that /boot is not already mounted by other means.

modules.d/01fips/fips.sh

index e0caf36d663ab5bece1ecf864a27009f54e68b5a..e49ff670be345fc9c3101419187d127e8b1d6ac0 100755 (executable)
@@ -47,7 +47,7 @@ mount_boot() {
         mkdir -p /boot
         fips_info "Mounting $boot as /boot"
         mount -oro "$boot" /boot || return 1
-    elif [ -d "$NEWROOT/boot" ]; then
+    elif ! ismounted /boot && [ -d "$NEWROOT/boot" ]; then
         # shellcheck disable=SC2114
         rm -fr -- /boot
         ln -sf "$NEWROOT/boot" /boot