History

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

Pull EFI fixes from Ard Biesheuvel: "These address all the outstanding EFI/x86 boot related regressions: - Revert to the old initrd memory allocation soft limit of INT_MAX, which was dropped inadvertently - Ensure that startup_32() is entered with a valid boot_params pointer when using the new EFI mixed mode protocol - Fix a compiler warning introduced by a fix from the previous pull" * tag 'efi-fixes-for-v6.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi: x86/efistub: Reinstate soft limit for initrd loading efi/libstub: Cast away type warning in use of max() x86/efistub: Add missing boot_params for mixed mode compat entry

Linus Torvalds committed 2 years ago

Commit 0eee99d2 parents 033e808 decd3473 files · +17 −6Browse files

Unified · Split

3 files
  1. arch/x86/boot/compressed/efi_mixed.S +15 −5
  2. drivers/firmware/efi/libstub/randomalloc.c +1 −1
  3. drivers/firmware/efi/libstub/x86-stub.c +1 −0
arch/x86/boot/compressed/efi_mixed.S+15−5
@@ -15,10 +15,12 @@ · 14 unmodified lines
15 */15 */
16 16
17#include <linux/linkage.h>17#include <linux/linkage.h>
18#include <asm/asm-offsets.h>
18#include <asm/msr.h>19#include <asm/msr.h>
19#include <asm/page_types.h>20#include <asm/page_types.h>
20#include <asm/processor-flags.h>21#include <asm/processor-flags.h>
21#include <asm/segment.h>22#include <asm/segment.h>
23#include <asm/setup.h>
22 24
23 .code6425 .code64
24 .text26 .text
@@ -149,6 +151,7 @@ SYM_FUNC_END(__efi64_thunk) · 124 unmodified lines
149SYM_FUNC_START(efi32_stub_entry)151SYM_FUNC_START(efi32_stub_entry)
150 call 1f152 call 1f
1511: popl %ecx1531: popl %ecx
154 leal (efi32_boot_args - 1b)(%ecx), %ebx
152 155
153 /* Clear BSS */156 /* Clear BSS */
154 xorl %eax, %eax157 xorl %eax, %eax
@@ -163,6 +166,7 @@ SYM_FUNC_START(efi32_stub_entry) · 8 unmodified lines
163 popl %ecx166 popl %ecx
164 popl %edx167 popl %edx
165 popl %esi168 popl %esi
169 movl %esi, 8(%ebx)
166 jmp efi32_entry170 jmp efi32_entry
167SYM_FUNC_END(efi32_stub_entry)171SYM_FUNC_END(efi32_stub_entry)
168#endif172#endif
@@ -239,8 +243,6 @@ SYM_FUNC_END(efi_enter32) · 70 unmodified lines
239 *243 *
240 * Arguments: %ecx image handle244 * Arguments: %ecx image handle
241 * %edx EFI system table pointer245 * %edx EFI system table pointer
242 * %esi struct bootparams pointer (or NULL when not using
243 * the EFI handover protocol)
244 *246 *
245 * Since this is the point of no return for ordinary execution, no registers247 * Since this is the point of no return for ordinary execution, no registers
246 * are considered live except for the function parameters. [Note that the EFI248 * are considered live except for the function parameters. [Note that the EFI
@@ -266,9 +268,18 @@ SYM_FUNC_START_LOCAL(efi32_entry) · 19 unmodified lines
266 leal (efi32_boot_args - 1b)(%ebx), %ebx268 leal (efi32_boot_args - 1b)(%ebx), %ebx
267 movl %ecx, 0(%ebx)269 movl %ecx, 0(%ebx)
268 movl %edx, 4(%ebx)270 movl %edx, 4(%ebx)
269 movl %esi, 8(%ebx)
270 movb $0x0, 12(%ebx) // efi_is64271 movb $0x0, 12(%ebx) // efi_is64
271 272
273 /*
274 * Allocate some memory for a temporary struct boot_params, which only
275 * needs the minimal pieces that startup_32() relies on.
276 */
277 subl $PARAM_SIZE, %esp
278 movl %esp, %esi
279 movl $PAGE_SIZE, BP_kernel_alignment(%esi)
280 movl $_end - 1b, BP_init_size(%esi)
281 subl $startup_32 - 1b, BP_init_size(%esi)
282
272 /* Disable paging */283 /* Disable paging */
273 movl %cr0, %eax284 movl %cr0, %eax
274 btrl $X86_CR0_PG_BIT, %eax285 btrl $X86_CR0_PG_BIT, %eax
@@ -294,8 +305,7 @@ SYM_FUNC_START(efi32_pe_entry) · 19 unmodified lines
294 305
295 movl 8(%ebp), %ecx // image_handle306 movl 8(%ebp), %ecx // image_handle
296 movl 12(%ebp), %edx // sys_table307 movl 12(%ebp), %edx // sys_table
297 xorl %esi, %esi308 jmp efi32_entry // pass %ecx, %edx
298 jmp efi32_entry // pass %ecx, %edx, %esi
299 // no other registers remain live309 // no other registers remain live
300 310
3012: popl %edi // restore callee-save registers3112: popl %edi // restore callee-save registers
drivers/firmware/efi/libstub/randomalloc.c+1−1
@@ -120,7 +120,7 @@ efi_status_t efi_random_alloc(unsigned long size, · 119 unmodified lines
120 continue;120 continue;
121 }121 }
122 122
123 target = round_up(max(md->phys_addr, alloc_min), align) + target_slot * align;123 target = round_up(max_t(u64, md->phys_addr, alloc_min), align) + target_slot * align;
124 pages = size / EFI_PAGE_SIZE;124 pages = size / EFI_PAGE_SIZE;
125 125
126 status = efi_bs_call(allocate_pages, EFI_ALLOCATE_ADDRESS,126 status = efi_bs_call(allocate_pages, EFI_ALLOCATE_ADDRESS,
drivers/firmware/efi/libstub/x86-stub.c+1−0
@@ -496,6 +496,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, · 495 unmodified lines
496 hdr->vid_mode = 0xffff;496 hdr->vid_mode = 0xffff;
497 497
498 hdr->type_of_loader = 0x21;498 hdr->type_of_loader = 0x21;
499 hdr->initrd_addr_max = INT_MAX;
499 500
500 /* Convert unicode cmdline to ascii */501 /* Convert unicode cmdline to ascii */
501 cmdline_ptr = efi_convert_cmdline(image, &options_size);502 cmdline_ptr = efi_convert_cmdline(image, &options_size);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t