All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <dkiper@net-space.pl>
Cc: Glenn Washburn <development@efficientek.com>
Subject: [PATCH] tests/util/grub-shell: Enable RNG device to better test stack smashing
Date: Thu, 31 Aug 2023 23:50:56 -0500	[thread overview]
Message-ID: <20230901045056.3461179-1-development@efficientek.com> (raw)

In certain firmwares, eg. 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>
---
This patch will potentially cause a lot of failures on EFI platforms
because of a bug in stack smashing initialization, which the list has
been notified of. This patch is in part meant to exercise that bug and
allows successful test runs when that bug is fixed.

Glenn
---
 tests/util/grub-shell.in | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 715e1c2e67b3..496e1bab33c8 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -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}
-- 
2.34.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

             reply	other threads:[~2023-09-01  4:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01  4:50 Glenn Washburn [this message]
2023-09-02 18:28 ` [PATCH] tests/util/grub-shell: Enable RNG device to better test stack smashing Daniel Kiper
2023-09-04 19:24   ` Glenn Washburn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230901045056.3461179-1-development@efficientek.com \
    --to=development@efficientek.com \
    --cc=dkiper@net-space.pl \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.