diff options
| author | Laura Abbott <lauraa@codeaurora.org> | 2014-04-14 20:09:44 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:03:20 -0700 |
| commit | 8f13b6041399a258373c52d0aabf9912a28cf19b (patch) | |
| tree | 3783945e0a54d00ffc51ea0fcc73b397fd5b77bf /mm/debug-pagealloc.c | |
| parent | ab7a3391608bd9e960806c4a781d8046925d7c4f (diff) | |
mm: Mark free pages as read only
Drivers have a tendency to scribble on everything, including free
pages. Make life easier by marking free pages as read only when
on the buddy list and re-marking as read/write when allocating.
Change-Id: I978ed2921394919917307b9c99217fdc22f82c59
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit 752f5aecb0511c4d661dce2538c723675c1e6449)
Diffstat (limited to '')
| -rw-r--r-- | mm/debug-pagealloc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/debug-pagealloc.c b/mm/debug-pagealloc.c index 5bf5906ce13b..feae18981174 100644 --- a/mm/debug-pagealloc.c +++ b/mm/debug-pagealloc.c @@ -6,6 +6,14 @@ #include <linux/poison.h> #include <linux/ratelimit.h> +#ifndef mark_addr_rdonly +#define mark_addr_rdonly(a) +#endif + +#ifndef mark_addr_rdwrite +#define mark_addr_rdwrite(a) +#endif + static bool page_poisoning_enabled __read_mostly; static bool need_page_poisoning(void) @@ -59,6 +67,7 @@ static void poison_page(struct page *page) set_page_poison(page); memset(addr, PAGE_POISON, PAGE_SIZE); + mark_addr_rdonly(addr); kunmap_atomic(addr); } @@ -113,6 +122,7 @@ static void unpoison_page(struct page *page) addr = kmap_atomic(page); check_poison_mem(addr, PAGE_SIZE); + mark_addr_rdwrite(addr); clear_page_poison(page); kunmap_atomic(addr); } |
