diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-07-10 02:12:10 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-07-10 02:12:10 +0200 |
commit | 4c0b6c10fbaf0c82efe2a7ba6c236c633d4f2ed7 (patch) | |
tree | ba2727168486504a256694aaa5f549bac1aa92eb /kernel/power/power.h | |
parent | d5f32af3100165cbd625855bd155b3aa9bd87ebf (diff) | |
download | linux-stable-4c0b6c10fbaf0c82efe2a7ba6c236c633d4f2ed7.tar.gz linux-stable-4c0b6c10fbaf0c82efe2a7ba6c236c633d4f2ed7.tar.bz2 linux-stable-4c0b6c10fbaf0c82efe2a7ba6c236c633d4f2ed7.zip |
PM / hibernate: Image data protection during restoration
Make it possible to protect all pages holding image data during
hibernate image restoration by setting them read-only (so as to
catch attempts to write to those pages after image data have been
stored in them).
This adds overhead to image restoration code (it may cause large
page mappings to be split as a result of page flags changes) and
the errors it protects against should never happen in theory, so
the feature is only active after passing hibernate=protect_image
to the command line of the restore kernel.
Also it only is built if CONFIG_DEBUG_RODATA is set.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/power/power.h')
-rw-r--r-- | kernel/power/power.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/power/power.h b/kernel/power/power.h index 51f02ecaf125..064963e89194 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h @@ -59,6 +59,13 @@ extern int hibernation_snapshot(int platform_mode); extern int hibernation_restore(int platform_mode); extern int hibernation_platform_enter(void); +#ifdef CONFIG_DEBUG_RODATA +/* kernel/power/snapshot.c */ +extern void enable_restore_image_protection(void); +#else +static inline void enable_restore_image_protection(void) {} +#endif /* CONFIG_DEBUG_RODATA */ + #else /* !CONFIG_HIBERNATION */ static inline void hibernate_reserved_size_init(void) {} |