diff options
author | Thomas Garnier <thgarnie@google.com> | 2016-08-11 17:49:29 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-08-12 16:50:42 -0400 |
commit | 62822e2ec4ad091ba31f823f577ef80db52e3c2c (patch) | |
tree | 5ad5beabd2c6d46e8949f32d1c359b094c12ba94 | |
parent | e4630fdd47637168927905983205d7b7c5c08c09 (diff) |
PM / hibernate: Restore processor state before using per-CPU variables
Restore the processor state before calling any other functions to
ensure per-CPU variables can be used with KASLR memory randomization.
Tracing functions use per-CPU variables (GS based on x86) and one was
called just before restoring the processor state fully. It resulted
in a double fault when both the tracing & the exception handler
functions tried to use a per-CPU variable.
Fixes: bb3632c6101b (PM / sleep: trace events for suspend/resume)
Reported-and-tested-by: Borislav Petkov <bp@suse.de>
Reported-by: Jiri Kosina <jikos@kernel.org>
Tested-by: Rafael J. Wysocki <rafael@kernel.org>
Tested-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Thomas Garnier <thgarnie@google.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | kernel/power/hibernate.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 0ee1df0a0bd6..61761aa7cc19 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -300,12 +300,12 @@ static int create_image(int platform_mode) | |||
300 | save_processor_state(); | 300 | save_processor_state(); |
301 | trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, true); | 301 | trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, true); |
302 | error = swsusp_arch_suspend(); | 302 | error = swsusp_arch_suspend(); |
303 | /* Restore control flow magically appears here */ | ||
304 | restore_processor_state(); | ||
303 | trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, false); | 305 | trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, false); |
304 | if (error) | 306 | if (error) |
305 | printk(KERN_ERR "PM: Error %d creating hibernation image\n", | 307 | printk(KERN_ERR "PM: Error %d creating hibernation image\n", |
306 | error); | 308 | error); |
307 | /* Restore control flow magically appears here */ | ||
308 | restore_processor_state(); | ||
309 | if (!in_suspend) | 309 | if (!in_suspend) |
310 | events_check_enabled = false; | 310 | events_check_enabled = false; |
311 | 311 | ||