efi: stub: use high allocation for converted command line
Before we can move the command line processing before the allocation of the kernel, which is required for detecting the 'nokaslr' option which controls that allocation, move the converted command line higher up in memory, to prevent it from interfering with the kernel itself. Since x86 needs the address to fit in 32 bits, use UINT_MAX as the upper bound there. Otherwise, use ULONG_MAX (i.e., no limit) Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit 48fcb2d0216103d15306caa4814e2381104df6d8) Signed-off-by: Alex Shi <alex.shi@linaro.org>
This commit is contained in:
parent
0f01a865b4
commit
4a9c1460b2
2 changed files with 8 additions and 1 deletions
|
@ -25,6 +25,8 @@
|
||||||
#define EFI32_LOADER_SIGNATURE "EL32"
|
#define EFI32_LOADER_SIGNATURE "EL32"
|
||||||
#define EFI64_LOADER_SIGNATURE "EL64"
|
#define EFI64_LOADER_SIGNATURE "EL64"
|
||||||
|
|
||||||
|
#define MAX_CMDLINE_ADDRESS UINT_MAX
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -649,6 +649,10 @@ static u8 *efi_utf16_to_utf8(u8 *dst, const u16 *src, int n)
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef MAX_CMDLINE_ADDRESS
|
||||||
|
#define MAX_CMDLINE_ADDRESS ULONG_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert the unicode UEFI command line to ASCII to pass to kernel.
|
* Convert the unicode UEFI command line to ASCII to pass to kernel.
|
||||||
* Size of memory allocated return in *cmd_line_len.
|
* Size of memory allocated return in *cmd_line_len.
|
||||||
|
@ -684,7 +688,8 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg,
|
||||||
|
|
||||||
options_bytes++; /* NUL termination */
|
options_bytes++; /* NUL termination */
|
||||||
|
|
||||||
status = efi_low_alloc(sys_table_arg, options_bytes, 0, &cmdline_addr);
|
status = efi_high_alloc(sys_table_arg, options_bytes, 0,
|
||||||
|
&cmdline_addr, MAX_CMDLINE_ADDRESS);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue