]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
tests/util/grub-shell: Enable RNG device to better test stack smashing
authorGlenn Washburn <development@efficientek.com>
Fri, 1 Sep 2023 04:50:56 +0000 (23:50 -0500)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 12 Oct 2023 16:48:28 +0000 (18:48 +0200)
In certain firmwares, e.g. OVMF, the RNG protocol is not enabled unless
there is an RNG device. When not enabled, GRUB fails to initialize the
stack guard with random bytes. For testing, this is not a big issue, but
there have been bugs found in the initialization. So turn this on for EFI
platforms to catch any regressions.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
tests/util/grub-shell.in

index 715e1c2e67b3db4645268c7fcb5d5dd8b6e87e88..496e1bab33c8c1558ae46740d5e324b764203050 100644 (file)
@@ -225,6 +225,13 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
        console=console;;
 esac
 
+case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # Only add the RNG device for EFI platforms because we currently only
+    # support Stack Smashing protection on EFI.
+    *-efi)
+       qemuopts="$qemuopts -device virtio-rng-pci" ;;
+esac
+
 timeout=${GRUB_SHELL_DEFAULT_TIMEOUT:-60}
 mkimage_extra_arg=
 debug=${GRUB_SHELL_DEFAULT_DEBUG:-$GRUB_TEST_DEFAULT_DEBUG}