aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorLaura Abbott <labbott@fedoraproject.org>2016-03-15 17:56:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-15 19:55:16 -0400
commit1414c7f4f7d72d138fff35f00151d15749b5beda (patch)
treee742e525f02ae4095e2a907cf8bc5fc29bfbc3dc /kernel/power
parent8823b1dbc05fab1a8bec275eeae4709257c2661d (diff)
mm/page_poisoning.c: allow for zero poisoning
By default, page poisoning uses a poison value (0xaa) on free. If this is changed to 0, the page is not only sanitized but zeroing on alloc with __GFP_ZERO can be skipped as well. The tradeoff is that detecting corruption from the poisoning is harder to detect. This feature also cannot be used with hibernation since pages are not guaranteed to be zeroed after hibernation. Credit to Grsecurity/PaX team for inspiring this work Signed-off-by: Laura Abbott <labbott@fedoraproject.org> Acked-by: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Michal Hocko <mhocko@suse.com> Cc: Kees Cook <keescook@chromium.org> Cc: Mathias Krause <minipli@googlemail.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Jianyu Zhan <nasa4836@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/hibernate.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index b7342a24f559..aa0f26b58426 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -1158,6 +1158,22 @@ static int __init kaslr_nohibernate_setup(char *str)
1158 return nohibernate_setup(str); 1158 return nohibernate_setup(str);
1159} 1159}
1160 1160
1161static int __init page_poison_nohibernate_setup(char *str)
1162{
1163#ifdef CONFIG_PAGE_POISONING_ZERO
1164 /*
1165 * The zeroing option for page poison skips the checks on alloc.
1166 * since hibernation doesn't save free pages there's no way to
1167 * guarantee the pages will still be zeroed.
1168 */
1169 if (!strcmp(str, "on")) {
1170 pr_info("Disabling hibernation due to page poisoning\n");
1171 return nohibernate_setup(str);
1172 }
1173#endif
1174 return 1;
1175}
1176
1161__setup("noresume", noresume_setup); 1177__setup("noresume", noresume_setup);
1162__setup("resume_offset=", resume_offset_setup); 1178__setup("resume_offset=", resume_offset_setup);
1163__setup("resume=", resume_setup); 1179__setup("resume=", resume_setup);
@@ -1166,3 +1182,4 @@ __setup("resumewait", resumewait_setup);
1166__setup("resumedelay=", resumedelay_setup); 1182__setup("resumedelay=", resumedelay_setup);
1167__setup("nohibernate", nohibernate_setup); 1183__setup("nohibernate", nohibernate_setup);
1168__setup("kaslr", kaslr_nohibernate_setup); 1184__setup("kaslr", kaslr_nohibernate_setup);
1185__setup("page_poison=", page_poison_nohibernate_setup);