Re: [PATCH v1.1] x86/mm/ASLR: Propagate ASLR status to kernel proper

Ingo Molnar
2015-04-02T11:07:21Z

* Borislav Petkov <bp@alien8.de> wrote:

> --- a/arch/x86/kernel/module.c
> +++ b/arch/x86/kernel/module.c
> @@ -33,6 +33,7 @@
>
> #include <asm/page.h>
> #include <asm/pgtable.h>
> +#include <asm/setup.h>
>
> #if 0
> #define DEBUGP(fmt, ...) \
> @@ -47,21 +48,13 @@ do { \
>
> #ifdef CONFIG_RANDOMIZE_BASE
> static unsigned long module_load_offset;
> -static int randomize_modules = 1;
>
> /* Mutex protects the module_load_offset. */
> static DEFINE_MUTEX(module_kaslr_mutex);
>
> -static int __init parse_nokaslr(char *p)
> -{
> - randomize_modules = 0;
> - return 0;
> -}
> -early_param("nokaslr", parse_nokaslr);

So doesn't a 'nokaslr' boot option still make sense, to be able to
debug KASLR failures and such?

> + if (kaslr_enabled())
> + pr_emerg("Kernel Offset: 0x%lx from 0x%lx (relocation range: 0x%lx-0x%lx)\n",
> + (unsigned long)&_text - __START_KERNEL,
> + __START_KERNEL,
> + __START_KERNEL_map,
> + MODULES_VADDR-1);
> + else
> + pr_emerg("Kernel Offset: disabled\n");

Nit: curly braces for multi-line statements and so.

Thanks,

Ingo