@@ -34,6 +34,7 @@ static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE;
static int __section(.data) __nokaslr;
static int __section(.data) __quiet;
+static int __section(.data) __vmalloc_arg;
int __pure nokaslr(void)
{
@@ -43,6 +44,10 @@ int __pure is_quiet(void)
{
return __quiet;
}
+int __pure have_vmalloc(void)
+{
+ return __vmalloc_arg;
+}
#define EFI_MMAP_NR_SLACK_SLOTS 8
@@ -433,6 +438,10 @@ efi_status_t efi_parse_options(char const *cmdline)
if (str == cmdline || (str && str > cmdline && *(str - 1) == ' '))
__quiet = 1;
+ str = strstr(cmdline, "vmalloc=");
+ if (str == cmdline || (str && str > cmdline && *(str - 1) == ' '))
+ __vmalloc_arg = 1;
+
/*
* If no EFI parameters were specified on the cmdline we've got
* nothing to do.
@@ -26,6 +26,7 @@
extern int __pure nokaslr(void);
extern int __pure is_quiet(void);
+extern int __pure have_vmalloc(void);
#define pr_efi(sys_table, msg) do { \
if (!is_quiet()) efi_printk(sys_table, "EFI stub: "msg); \
Check for and record the presence of a vmalloc= argument on the kernel command line. We need this information on ARM systems when implementing KASLR, given that the size of the vmalloc region will affect the size of the lowmem region, therefore affecting the available randomization range as well. Cc: Matt Fleming <matt@codeblueprint.co.uk> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> --- drivers/firmware/efi/libstub/efi-stub-helper.c | 9 +++++++++ drivers/firmware/efi/libstub/efistub.h | 1 + 2 files changed, 10 insertions(+)