Skip to content

Commit 65fe935

Browse files
keesIngo Molnar
authored andcommitted
x86/KASLR, x86/power: Remove x86 hibernation restrictions
With the following fix: 70595b479ce1 ("x86/power/64: Fix crash whan the hibernation code passes control to the image kernel") ... there is no longer a problem with hibernation resuming a KASLR-booted kernel image, so remove the restriction. Signed-off-by: Kees Cook <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Baoquan He <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Len Brown <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Linux PM list <[email protected]> Cc: Logan Gunthorpe <[email protected]> Cc: Pavel Machek <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephen Smalley <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Yinghai Lu <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 8d950d2 commit 65fe935

File tree

3 files changed

+4
-19
lines changed

3 files changed

+4
-19
lines changed

Documentation/kernel-parameters.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,12 +1803,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
18031803
js= [HW,JOY] Analog joystick
18041804
See Documentation/input/joystick.txt.
18051805

1806-
kaslr/nokaslr [X86]
1807-
Enable/disable kernel and module base offset ASLR
1808-
(Address Space Layout Randomization) if built into
1809-
the kernel. When CONFIG_HIBERNATION is selected,
1810-
kASLR is disabled by default. When kASLR is enabled,
1811-
hibernation will be disabled.
1806+
nokaslr [KNL]
1807+
When CONFIG_RANDOMIZE_BASE is set, this disables
1808+
kernel and module base offset ASLR (Address Space
1809+
Layout Randomization).
18121810

18131811
keepinitrd [HW,ARM]
18141812

arch/x86/boot/compressed/kaslr.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -471,17 +471,10 @@ unsigned char *choose_random_location(unsigned long input,
471471
unsigned long choice = output;
472472
unsigned long random_addr;
473473

474-
#ifdef CONFIG_HIBERNATION
475-
if (!cmdline_find_option_bool("kaslr")) {
476-
warn("KASLR disabled: 'kaslr' not on cmdline (hibernation selected).");
477-
goto out;
478-
}
479-
#else
480474
if (cmdline_find_option_bool("nokaslr")) {
481475
warn("KASLR disabled: 'nokaslr' on cmdline.");
482476
goto out;
483477
}
484-
#endif
485478

486479
boot_params->hdr.loadflags |= KASLR_FLAG;
487480

kernel/power/hibernate.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,11 +1154,6 @@ static int __init nohibernate_setup(char *str)
11541154
return 1;
11551155
}
11561156

1157-
static int __init kaslr_nohibernate_setup(char *str)
1158-
{
1159-
return nohibernate_setup(str);
1160-
}
1161-
11621157
static int __init page_poison_nohibernate_setup(char *str)
11631158
{
11641159
#ifdef CONFIG_PAGE_POISONING_ZERO
@@ -1182,5 +1177,4 @@ __setup("hibernate=", hibernate_setup);
11821177
__setup("resumewait", resumewait_setup);
11831178
__setup("resumedelay=", resumedelay_setup);
11841179
__setup("nohibernate", nohibernate_setup);
1185-
__setup("kaslr", kaslr_nohibernate_setup);
11861180
__setup("page_poison=", page_poison_nohibernate_setup);

0 commit comments

Comments
 (0)