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 branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull EFI fixes from Thomas Gleixner:

- Use explicitely sized type for the romimage pointer in the 32bit EFI
protocol struct so a 64bit kernel does not expand it to 64bit. Ditto
for the 64bit struct to avoid the reverse issue on 32bit kernels.

- Handle randomized tex offset correctly in the ARM64 EFI stub to avoid
unaligned data resulting in stack corruption and other hard to
diagnose wreckage.

* 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
efi/libstub/arm64: Handle randomized TEXT_OFFSET
efi: Avoid potential crashes, fix the 'struct efi_pci_io_protocol_32' definition for mixed mode

+18 -6
+4 -2
arch/x86/boot/compressed/eboot.c
··· 163 163 if (status != EFI_SUCCESS) 164 164 goto free_struct; 165 165 166 - memcpy(rom->romdata, pci->romimage, pci->romsize); 166 + memcpy(rom->romdata, (void *)(unsigned long)pci->romimage, 167 + pci->romsize); 167 168 return status; 168 169 169 170 free_struct: ··· 270 269 if (status != EFI_SUCCESS) 271 270 goto free_struct; 272 271 273 - memcpy(rom->romdata, pci->romimage, pci->romsize); 272 + memcpy(rom->romdata, (void *)(unsigned long)pci->romimage, 273 + pci->romsize); 274 274 return status; 275 275 276 276 free_struct:
+10
drivers/firmware/efi/libstub/arm64-stub.c
··· 98 98 (phys_seed >> 32) & mask : TEXT_OFFSET; 99 99 100 100 /* 101 + * With CONFIG_RANDOMIZE_TEXT_OFFSET=y, TEXT_OFFSET may not 102 + * be a multiple of EFI_KIMG_ALIGN, and we must ensure that 103 + * we preserve the misalignment of 'offset' relative to 104 + * EFI_KIMG_ALIGN so that statically allocated objects whose 105 + * alignment exceeds PAGE_SIZE appear correctly aligned in 106 + * memory. 107 + */ 108 + offset |= TEXT_OFFSET % EFI_KIMG_ALIGN; 109 + 110 + /* 101 111 * If KASLR is enabled, and we have some randomness available, 102 112 * locate the kernel at a randomized offset in physical memory. 103 113 */
+4 -4
include/linux/efi.h
··· 395 395 u32 attributes; 396 396 u32 get_bar_attributes; 397 397 u32 set_bar_attributes; 398 - uint64_t romsize; 399 - void *romimage; 398 + u64 romsize; 399 + u32 romimage; 400 400 } efi_pci_io_protocol_32; 401 401 402 402 typedef struct { ··· 415 415 u64 attributes; 416 416 u64 get_bar_attributes; 417 417 u64 set_bar_attributes; 418 - uint64_t romsize; 419 - void *romimage; 418 + u64 romsize; 419 + u64 romimage; 420 420 } efi_pci_io_protocol_64; 421 421 422 422 typedef struct {