aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/page-debug-flags.h
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2009-03-31 18:23:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:13 -0400
commit6a11f75b6a17b5d9ac5025f8d048382fd1f47377 (patch)
treea3415cd897823975b927f89a233d2703bf97ba2b /include/linux/page-debug-flags.h
parent610a77e04a8d9fe8764dc484e2182fa251ce1cc2 (diff)
generic debug pagealloc
CONFIG_DEBUG_PAGEALLOC is now supported by x86, powerpc, sparc64, and s390. This patch implements it for the rest of the architectures by filling the pages with poison byte patterns after free_pages() and verifying the poison patterns before alloc_pages(). This generic one cannot detect invalid page accesses immediately but invalid read access may cause invalid dereference by poisoned memory and invalid write access can be detected after a long delay. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/page-debug-flags.h')
-rw-r--r--include/linux/page-debug-flags.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/page-debug-flags.h b/include/linux/page-debug-flags.h
new file mode 100644
index 000000000000..b0638fd91e92
--- /dev/null
+++ b/include/linux/page-debug-flags.h
@@ -0,0 +1,30 @@
1#ifndef LINUX_PAGE_DEBUG_FLAGS_H
2#define LINUX_PAGE_DEBUG_FLAGS_H
3
4/*
5 * page->debug_flags bits:
6 *
7 * PAGE_DEBUG_FLAG_POISON is set for poisoned pages. This is used to
8 * implement generic debug pagealloc feature. The pages are filled with
9 * poison patterns and set this flag after free_pages(). The poisoned
10 * pages are verified whether the patterns are not corrupted and clear
11 * the flag before alloc_pages().
12 */
13
14enum page_debug_flags {
15 PAGE_DEBUG_FLAG_POISON, /* Page is poisoned */
16};
17
18/*
19 * Ensure that CONFIG_WANT_PAGE_DEBUG_FLAGS reliably
20 * gets turned off when no debug features are enabling it!
21 */
22
23#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
24#if !defined(CONFIG_PAGE_POISONING) \
25/* && !defined(CONFIG_PAGE_DEBUG_SOMETHING_ELSE) && ... */
26#error WANT_PAGE_DEBUG_FLAGS is turned on with no debug features!
27#endif
28#endif /* CONFIG_WANT_PAGE_DEBUG_FLAGS */
29
30#endif /* LINUX_PAGE_DEBUG_FLAGS_H */