Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'efi-fixes-for-v6.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi

Pull EFI fixes from Ard Biesheuvel:
"Another small set of EFI fixes. Only the x86 one is likely to affect
any actual users (and has a cc:stable), but the issue it fixes was
only observed in an unusual context (kexec in a confidential VM).

- Ensure that EFI runtime services are not unmapped by PAN on ARM

- Avoid freeing the memory holding the EFI memory map inadvertently
on x86

- Avoid a false positive kmemleak warning on arm64"

* tag 'efi-fixes-for-v6.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
efi/arm64: Fix kmemleak false positive in arm64_efi_rt_init()
efi/x86: Free EFI memory map only when installing a new one.
efi/arm: Disable LPAE PAN when calling EFI runtime services

+26 -11
+13
arch/arm/include/asm/efi.h
··· 14 14 #include <asm/mach/map.h> 15 15 #include <asm/mmu_context.h> 16 16 #include <asm/ptrace.h> 17 + #include <asm/uaccess.h> 17 18 18 19 #ifdef CONFIG_EFI 19 20 void efi_init(void); ··· 25 24 26 25 #define arch_efi_call_virt_setup() efi_virtmap_load() 27 26 #define arch_efi_call_virt_teardown() efi_virtmap_unload() 27 + 28 + #ifdef CONFIG_CPU_TTBR0_PAN 29 + #undef arch_efi_call_virt 30 + #define arch_efi_call_virt(p, f, args...) ({ \ 31 + unsigned int flags = uaccess_save_and_enable(); \ 32 + efi_status_t res = _Generic((p)->f(args), \ 33 + efi_status_t: (p)->f(args), \ 34 + default: ((p)->f(args), EFI_ABORTED)); \ 35 + uaccess_restore(flags); \ 36 + res; \ 37 + }) 38 + #endif 28 39 29 40 #define ARCH_EFI_IRQ_FLAGS_MASK \ 30 41 (PSR_J_BIT | PSR_E_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | \
+2
arch/arm64/kernel/efi.c
··· 9 9 10 10 #include <linux/efi.h> 11 11 #include <linux/init.h> 12 + #include <linux/kmemleak.h> 12 13 #include <linux/screen_info.h> 13 14 #include <linux/vmalloc.h> 14 15 ··· 214 213 return -ENOMEM; 215 214 } 216 215 216 + kmemleak_not_leak(p); 217 217 efi_rt_stack_top = p + THREAD_SIZE; 218 218 return 0; 219 219 }
-1
arch/x86/include/asm/efi.h
··· 401 401 struct efi_memory_map_data *data); 402 402 extern void __efi_memmap_free(u64 phys, unsigned long size, 403 403 unsigned long flags); 404 - #define __efi_memmap_free __efi_memmap_free 405 404 406 405 extern int __init efi_memmap_install(struct efi_memory_map_data *data); 407 406 extern int __init efi_memmap_split_count(efi_memory_desc_t *md,
+11 -1
arch/x86/platform/efi/memmap.c
··· 92 92 */ 93 93 int __init efi_memmap_install(struct efi_memory_map_data *data) 94 94 { 95 + unsigned long size = efi.memmap.desc_size * efi.memmap.nr_map; 96 + unsigned long flags = efi.memmap.flags; 97 + u64 phys = efi.memmap.phys_map; 98 + int ret; 99 + 95 100 efi_memmap_unmap(); 96 101 97 102 if (efi_enabled(EFI_PARAVIRT)) 98 103 return 0; 99 104 100 - return __efi_memmap_init(data); 105 + ret = __efi_memmap_init(data); 106 + if (ret) 107 + return ret; 108 + 109 + __efi_memmap_free(phys, size, flags); 110 + return 0; 101 111 } 102 112 103 113 /**
-9
drivers/firmware/efi/memmap.c
··· 15 15 #include <asm/early_ioremap.h> 16 16 #include <asm/efi.h> 17 17 18 - #ifndef __efi_memmap_free 19 - #define __efi_memmap_free(phys, size, flags) do { } while (0) 20 - #endif 21 - 22 18 /** 23 19 * __efi_memmap_init - Common code for mapping the EFI memory map 24 20 * @data: EFI memory map data ··· 46 50 pr_err("Could not map the memory map!\n"); 47 51 return -ENOMEM; 48 52 } 49 - 50 - if (efi.memmap.flags & (EFI_MEMMAP_MEMBLOCK | EFI_MEMMAP_SLAB)) 51 - __efi_memmap_free(efi.memmap.phys_map, 52 - efi.memmap.desc_size * efi.memmap.nr_map, 53 - efi.memmap.flags); 54 53 55 54 map.phys_map = data->phys_map; 56 55 map.nr_map = data->size / data->desc_size;