summaryrefslogtreecommitdiff
path: root/user/grub/0004-videoinfo-no-reinit.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2023-10-01 03:44:11 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2023-10-03 21:56:52 -0500
commit8b868f32f7e1b57c90da65157ea59eb6ce337cc9 (patch)
tree3659db750a529d3e7abf0bc2c4f1fdbb3f0886af /user/grub/0004-videoinfo-no-reinit.patch
parent2c9ea8d0ea3c4510b5a4c9314c84c4444c933726 (diff)
downloadpackages-8b868f32f7e1b57c90da65157ea59eb6ce337cc9.tar.gz
packages-8b868f32f7e1b57c90da65157ea59eb6ce337cc9.tar.bz2
packages-8b868f32f7e1b57c90da65157ea59eb6ce337cc9.tar.xz
packages-8b868f32f7e1b57c90da65157ea59eb6ce337cc9.zip
user/grub: Update to 2.12_rc1
Fixes: #1065, #1066, #1073
Diffstat (limited to 'user/grub/0004-videoinfo-no-reinit.patch')
-rw-r--r--user/grub/0004-videoinfo-no-reinit.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/user/grub/0004-videoinfo-no-reinit.patch b/user/grub/0004-videoinfo-no-reinit.patch
new file mode 100644
index 000000000..c3877bf07
--- /dev/null
+++ b/user/grub/0004-videoinfo-no-reinit.patch
@@ -0,0 +1,49 @@
+From 1de58326994b0045ccfb28017d05fc1ddecdb92d Mon Sep 17 00:00:00 2001
+From: Glenn Washburn <development@efficientek.com>
+Date: Fri, 11 Aug 2023 16:30:04 -0500
+Subject: commands/videoinfo: Prevent crash when run while video driver already
+ active
+
+The videoinfo command will initialize all non-active video adapters. Video
+drivers tend to zero out the global framebuffer object on initialization.
+This is not a problem when there is no active video adapter. However, when
+there is, then outputting to the video adapter will cause a crash because
+methods in the framebuffer object are reinitialized. For example, this
+command sequence will cause a crash.
+
+ terminal_output --append gfxterm; videoinfo
+
+When running in a QEMU headless with GRUB built for the x86_64-efi target,
+the first command initializes the Bochs video adapter, which, among
+other things, sets the set_page() member function. Then when videoinfo is
+run, all non-Bochs video adapters will be initialized, each one wiping
+the framebuffer and thus setting set_page to NULL. Soon after the videoinfo
+command finishes there will be a call to grub_refresh(), which will
+ultimately call the framebuffer's set_page which will be NULL and cause
+a crash when called.
+
+Signed-off-by: Glenn Washburn <development@efficientek.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/commands/videoinfo.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/grub-core/commands/videoinfo.c b/grub-core/commands/videoinfo.c
+index 5eb9697..205ba78 100644
+--- a/grub-core/commands/videoinfo.c
++++ b/grub-core/commands/videoinfo.c
+@@ -191,6 +191,11 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
+ /* Don't worry about errors. */
+ grub_errno = GRUB_ERR_NONE;
+ }
++ else if (id != GRUB_VIDEO_DRIVER_NONE)
++ {
++ grub_puts_ (N_(" A video driver is active, cannot initialize this driver until it is deactivated\n"));
++ continue;
++ }
+ else
+ {
+ if (adapter->init ())
+--
+cgit v1.1
+