Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1306206
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 20/21] efi: stub: use high allocation for converted command line |
| Date | 2016-01-11 14:30 +0100 |
| Message-ID | <qPKHO-2Wj-55@gated-at.bofh.it> (permalink) |
| References | <qPKy5-2SK-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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) Cc: Matt Fleming <matt@codeblueprint.co.uk> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> --- arch/x86/include/asm/efi.h | 2 ++ drivers/firmware/efi/libstub/efi-stub-helper.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 0010c78c4998..08b1f2f6ea50 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -25,6 +25,8 @@ #define EFI32_LOADER_SIGNATURE "EL32" #define EFI64_LOADER_SIGNATURE "EL64" +#define MAX_CMDLINE_ADDRESS UINT_MAX + #ifdef CONFIG_X86_32 diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index f07d4a67fa76..2a7a3015d7e0 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c @@ -649,6 +649,10 @@ static u8 *efi_utf16_to_utf8(u8 *dst, const u16 *src, int n) 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. * Size of memory allocated return in *cmd_line_len. @@ -684,7 +688,15 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg, options_bytes++; /* NUL termination */ - status = efi_low_alloc(sys_table_arg, options_bytes, 0, &cmdline_addr); + /* + * Allocate a buffer for the converted command line as high up + * in memory as is feasible: x86 needs the command line allocation + * to be below 4 GB, but non-x86 architectures may not have any + * memory there. So prefer below 4 GB, and allocate anywhere if + * that fails. + */ + status = efi_high_alloc(sys_table_arg, options_bytes, 0, + &cmdline_addr, MAX_CMDLINE_ADDRESS); if (status != EFI_SUCCESS) return NULL; -- 2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 00/21] arm64: implement support for KASLR Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:20 +0100
[PATCH v3 14/21] arm64: [re]define SWAPPER_TABLE_[SHIFT|SIZE] for use in asm code Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
Re: [PATCH v3 14/21] arm64: [re]define SWAPPER_TABLE_[SHIFT|SIZE] for use in asm code Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 08/21] arm64: add support for module PLTs Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 04/21] arm64: decouple early fixmap init from linear mapping Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
Re: [PATCH v3 04/21] arm64: decouple early fixmap init from linear mapping Mark Rutland <mark.rutland@arm.com> - 2016-01-11 17:10 +0100
Re: [PATCH v3 04/21] arm64: decouple early fixmap init from linear mapping Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 17:20 +0100
Re: [PATCH v3 04/21] arm64: decouple early fixmap init from linear mapping Mark Rutland <mark.rutland@arm.com> - 2016-01-11 17:30 +0100
Re: [PATCH v3 04/21] arm64: decouple early fixmap init from linear mapping Mark Rutland <mark.rutland@arm.com> - 2016-01-11 18:00 +0100
Re: [PATCH v3 04/21] arm64: decouple early fixmap init from linear mapping Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 18:10 +0100
Re: [PATCH v3 04/21] arm64: decouple early fixmap init from linear mapping Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 18:20 +0100
Re: [PATCH v3 04/21] arm64: decouple early fixmap init from linear mapping Mark Rutland <mark.rutland@arm.com> - 2016-01-11 18:30 +0100
[PATCH v3 14/21] arm64: redefine SWAPPER_TABLE_SHIFT for use in asm code Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 01/21] of/fdt: make memblock minimum physical address arch configurable Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 16/21] scripts/sortextable: add support for ET_DYN binaries Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 17/21] arm64: add support for a relocatable kernel and KASLR Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 11/21] arm64: avoid R_AARCH64_ABS64 relocations for Image header fields Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
Re: [PATCH v3 11/21] arm64: avoid R_AARCH64_ABS64 relocations for Image header fields Mark Rutland <mark.rutland@arm.com> - 2016-01-13 19:20 +0100
Re: [PATCH v3 11/21] arm64: avoid R_AARCH64_ABS64 relocations for Image header fields Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-13 19:50 +0100
Re: [PATCH v3 11/21] arm64: avoid R_AARCH64_ABS64 relocations for Image header fields Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-14 10:00 +0100
Re: [PATCH v3 11/21] arm64: avoid R_AARCH64_ABS64 relocations for Image header fields Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-14 10:10 +0100
Re: [PATCH v3 11/21] arm64: avoid R_AARCH64_ABS64 relocations for Image header fields Mark Rutland <mark.rutland@arm.com> - 2016-01-14 11:50 +0100
Re: [PATCH v3 11/21] arm64: avoid R_AARCH64_ABS64 relocations for Image header fields Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-14 12:30 +0100
[PATCH v3 06/21] arm64: pgtable: implement static [pte|pmd|pud]_offset variants Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
Re: [PATCH v3 06/21] arm64: pgtable: implement static [pte|pmd|pud]_offset variants Mark Rutland <mark.rutland@arm.com> - 2016-01-11 17:30 +0100
Re: [PATCH v3 06/21] arm64: pgtable: implement static [pte|pmd|pud]_offset variants Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 18:30 +0100
Re: [PATCH v3 06/21] arm64: pgtable: implement static [pte|pmd|pud]_offset variants Mark Rutland <mark.rutland@arm.com> - 2016-01-11 18:40 +0100
[PATCH v3 13/21] arm64: allow kernel Image to be loaded anywhere in physical memory Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 12/21] arm64: avoid dynamic relocations in early boot code Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
Re: [PATCH v3 12/21] arm64: avoid dynamic relocations in early boot code Mark Rutland <mark.rutland@arm.com> - 2016-01-14 18:20 +0100
[PATCH v3 15/21] arm64: split elf relocs into a separate header. Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 09/21] extable: add support for relative extables to search and sort routines Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 10/21] arm64: switch to relative exception tables Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 19/21] efi: stub: add implementation of efi_random_alloc() Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 18/21] efi: stub: implement efi_get_random_bytes() based on EFI_RNG_PROTOCOL Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 20/21] efi: stub: use high allocation for converted command line Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
[PATCH v3 21/21] arm64: efi: invoke EFI_RNG_PROTOCOL to supply KASLR randomness Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-11 14:30 +0100
Re: [PATCH v3 00/21] arm64: implement support for KASLR Kees Cook <keescook@chromium.org> - 2016-01-11 23:10 +0100
Re: [PATCH v3 00/21] arm64: implement support for KASLR Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-12 08:20 +0100
csiph-web