]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.6
authorSasha Levin <sashal@kernel.org>
Sun, 24 Mar 2024 21:25:30 +0000 (17:25 -0400)
committerSasha Levin <sashal@kernel.org>
Sun, 24 Mar 2024 21:25:30 +0000 (17:25 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-6.6/series
queue-6.6/x86-efistub-don-t-clear-bss-twice-in-mixed-mode.patch [new file with mode: 0644]

index 5915c9ef07ad1d1a364af7182a1f04e43e61d348..9b427825489147d0bab791fd6c470a172f4f1ba3 100644 (file)
@@ -634,3 +634,4 @@ selftests-forwarding-fix-ping-failure-due-to-short-t.patch
 dm-io-support-io-priority.patch
 dm-integrity-align-the-outgoing-bio-in-integrity_rec.patch
 x86-efistub-clear-decompressor-bss-in-native-efi-ent.patch
+x86-efistub-don-t-clear-bss-twice-in-mixed-mode.patch
diff --git a/queue-6.6/x86-efistub-don-t-clear-bss-twice-in-mixed-mode.patch b/queue-6.6/x86-efistub-don-t-clear-bss-twice-in-mixed-mode.patch
new file mode 100644 (file)
index 0000000..2a44871
--- /dev/null
@@ -0,0 +1,43 @@
+From 862c8e3e5953095b68ae809c73083ac5c25e9edd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 22 Mar 2024 17:01:45 +0100
+Subject: x86/efistub: Don't clear BSS twice in mixed mode
+
+From: Ard Biesheuvel <ardb@kernel.org>
+
+[ Upstream commit df7ecce842b846a04d087ba85fdb79a90e26a1b0 ]
+
+Clearing BSS should only be done once, at the very beginning.
+efi_pe_entry() is the entrypoint from the firmware, which may not clear
+BSS and so it is done explicitly. However, efi_pe_entry() is also used
+as an entrypoint by the mixed mode startup code, in which case BSS will
+already have been cleared, and doing it again at this point will corrupt
+global variables holding the firmware's GDT/IDT and segment selectors.
+
+So make the memset() conditional on whether the EFI stub is running in
+native mode.
+
+Fixes: b3810c5a2cc4a666 ("x86/efistub: Clear decompressor BSS in native EFI entrypoint")
+Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/firmware/efi/libstub/x86-stub.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
+index 90f18315e0247..d186617a93f88 100644
+--- a/drivers/firmware/efi/libstub/x86-stub.c
++++ b/drivers/firmware/efi/libstub/x86-stub.c
+@@ -467,7 +467,8 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
+       efi_status_t status;
+       char *cmdline_ptr;
+-      memset(_bss, 0, _ebss - _bss);
++      if (efi_is_native())
++              memset(_bss, 0, _ebss - _bss);
+       efi_system_table = sys_table_arg;
+-- 
+2.43.0
+