8ab3820fd5
This allows decompress_kernel to return a new location for the kernel to be relocated to. Additionally, enforces CONFIG_PHYSICAL_START as the minimum relocation position when building with CONFIG_RELOCATABLE. With CONFIG_RANDOMIZE_BASE set, the choose_kernel_location routine will select a new location to decompress the kernel, though here it is presently a no-op. The kernel command line option "nokaslr" is introduced to bypass these routines. Signed-off-by: Kees Cook <keescook@chromium.org> Link: http://lkml.kernel.org/r/1381450698-28710-3-git-send-email-keescook@chromium.org Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
24 lines
477 B
C
24 lines
477 B
C
#include "misc.h"
|
|
|
|
#ifdef CONFIG_RANDOMIZE_BASE
|
|
|
|
unsigned char *choose_kernel_location(unsigned char *input,
|
|
unsigned long input_size,
|
|
unsigned char *output,
|
|
unsigned long output_size)
|
|
{
|
|
unsigned long choice = (unsigned long)output;
|
|
|
|
if (cmdline_find_option_bool("nokaslr")) {
|
|
debug_putstr("KASLR disabled...\n");
|
|
goto out;
|
|
}
|
|
|
|
/* XXX: choose random location. */
|
|
|
|
out:
|
|
return (unsigned char *)choice;
|
|
}
|
|
|
|
#endif /* CONFIG_RANDOMIZE_BASE */
|