Patch "x86/efistub: Don't clear BSS twice in mixed mode" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/efistub: Don't clear BSS twice in mixed mode

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-efistub-don-t-clear-bss-twice-in-mixed-mode.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 862c8e3e5953095b68ae809c73083ac5c25e9edd
Author: Ard Biesheuvel <ardb@xxxxxxxxxx>
Date:   Fri Mar 22 17:01:45 2024 +0100

    x86/efistub: Don't clear BSS twice in mixed mode
    
    [ 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@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

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;
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux