diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2009-03-31 18:23:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 11:59:13 -0400 |
commit | 6a11f75b6a17b5d9ac5025f8d048382fd1f47377 (patch) | |
tree | a3415cd897823975b927f89a233d2703bf97ba2b /arch | |
parent | 610a77e04a8d9fe8764dc484e2182fa251ce1cc2 (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 'arch')
-rw-r--r-- | arch/avr32/mm/fault.c | 18 | ||||
-rw-r--r-- | arch/powerpc/Kconfig | 3 | ||||
-rw-r--r-- | arch/powerpc/Kconfig.debug | 1 | ||||
-rw-r--r-- | arch/s390/Kconfig | 3 | ||||
-rw-r--r-- | arch/s390/Kconfig.debug | 1 | ||||
-rw-r--r-- | arch/sparc/Kconfig | 3 | ||||
-rw-r--r-- | arch/sparc/Kconfig.debug | 3 | ||||
-rw-r--r-- | arch/x86/Kconfig | 3 | ||||
-rw-r--r-- | arch/x86/Kconfig.debug | 1 |
9 files changed, 17 insertions, 19 deletions
diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c index ce4e4296b954..62d4abbaa654 100644 --- a/arch/avr32/mm/fault.c +++ b/arch/avr32/mm/fault.c | |||
@@ -250,21 +250,3 @@ asmlinkage void do_bus_error(unsigned long addr, int write_access, | |||
250 | dump_dtlb(); | 250 | dump_dtlb(); |
251 | die("Bus Error", regs, SIGKILL); | 251 | die("Bus Error", regs, SIGKILL); |
252 | } | 252 | } |
253 | |||
254 | /* | ||
255 | * This functionality is currently not possible to implement because | ||
256 | * we're using segmentation to ensure a fixed mapping of the kernel | ||
257 | * virtual address space. | ||
258 | * | ||
259 | * It would be possible to implement this, but it would require us to | ||
260 | * disable segmentation at startup and load the kernel mappings into | ||
261 | * the TLB like any other pages. There will be lots of trickery to | ||
262 | * avoid recursive invocation of the TLB miss handler, though... | ||
263 | */ | ||
264 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
265 | void kernel_map_pages(struct page *page, int numpages, int enable) | ||
266 | { | ||
267 | |||
268 | } | ||
269 | EXPORT_SYMBOL(kernel_map_pages); | ||
270 | #endif | ||
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index ad6b1c084fe3..45192dce65c4 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -228,6 +228,9 @@ config PPC_OF_PLATFORM_PCI | |||
228 | depends on PPC64 # not supported on 32 bits yet | 228 | depends on PPC64 # not supported on 32 bits yet |
229 | default n | 229 | default n |
230 | 230 | ||
231 | config ARCH_SUPPORTS_DEBUG_PAGEALLOC | ||
232 | def_bool y | ||
233 | |||
231 | source "init/Kconfig" | 234 | source "init/Kconfig" |
232 | 235 | ||
233 | source "kernel/Kconfig.freezer" | 236 | source "kernel/Kconfig.freezer" |
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug index 22091bbfdc9b..6aa0b5e087cd 100644 --- a/arch/powerpc/Kconfig.debug +++ b/arch/powerpc/Kconfig.debug | |||
@@ -30,6 +30,7 @@ config DEBUG_STACK_USAGE | |||
30 | config DEBUG_PAGEALLOC | 30 | config DEBUG_PAGEALLOC |
31 | bool "Debug page memory allocations" | 31 | bool "Debug page memory allocations" |
32 | depends on DEBUG_KERNEL && !HIBERNATION | 32 | depends on DEBUG_KERNEL && !HIBERNATION |
33 | depends on ARCH_SUPPORTS_DEBUG_PAGEALLOC | ||
33 | help | 34 | help |
34 | Unmap pages from the kernel linear mapping after free_pages(). | 35 | Unmap pages from the kernel linear mapping after free_pages(). |
35 | This results in a large slowdown, but helps to find certain types | 36 | This results in a large slowdown, but helps to find certain types |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 2a8af5e16345..dcb667c4375a 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -72,6 +72,9 @@ config PGSTE | |||
72 | config VIRT_CPU_ACCOUNTING | 72 | config VIRT_CPU_ACCOUNTING |
73 | def_bool y | 73 | def_bool y |
74 | 74 | ||
75 | config ARCH_SUPPORTS_DEBUG_PAGEALLOC | ||
76 | def_bool y | ||
77 | |||
75 | mainmenu "Linux Kernel Configuration" | 78 | mainmenu "Linux Kernel Configuration" |
76 | 79 | ||
77 | config S390 | 80 | config S390 |
diff --git a/arch/s390/Kconfig.debug b/arch/s390/Kconfig.debug index 4599fa06bd82..7e297a3cde34 100644 --- a/arch/s390/Kconfig.debug +++ b/arch/s390/Kconfig.debug | |||
@@ -9,6 +9,7 @@ source "lib/Kconfig.debug" | |||
9 | config DEBUG_PAGEALLOC | 9 | config DEBUG_PAGEALLOC |
10 | bool "Debug page memory allocations" | 10 | bool "Debug page memory allocations" |
11 | depends on DEBUG_KERNEL | 11 | depends on DEBUG_KERNEL |
12 | depends on ARCH_SUPPORTS_DEBUG_PAGEALLOC | ||
12 | help | 13 | help |
13 | Unmap pages from the kernel linear mapping after free_pages(). | 14 | Unmap pages from the kernel linear mapping after free_pages(). |
14 | This results in a slowdown, but helps to find certain types of | 15 | This results in a slowdown, but helps to find certain types of |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index c3ea215334f6..cc12cd48bbc5 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -124,6 +124,9 @@ config ARCH_NO_VIRT_TO_BUS | |||
124 | config OF | 124 | config OF |
125 | def_bool y | 125 | def_bool y |
126 | 126 | ||
127 | config ARCH_SUPPORTS_DEBUG_PAGEALLOC | ||
128 | def_bool y if SPARC64 | ||
129 | |||
127 | source "init/Kconfig" | 130 | source "init/Kconfig" |
128 | 131 | ||
129 | source "kernel/Kconfig.freezer" | 132 | source "kernel/Kconfig.freezer" |
diff --git a/arch/sparc/Kconfig.debug b/arch/sparc/Kconfig.debug index b8a15e271bfa..d001b42041a5 100644 --- a/arch/sparc/Kconfig.debug +++ b/arch/sparc/Kconfig.debug | |||
@@ -24,7 +24,8 @@ config STACK_DEBUG | |||
24 | 24 | ||
25 | config DEBUG_PAGEALLOC | 25 | config DEBUG_PAGEALLOC |
26 | bool "Debug page memory allocations" | 26 | bool "Debug page memory allocations" |
27 | depends on SPARC64 && DEBUG_KERNEL && !HIBERNATION | 27 | depends on DEBUG_KERNEL && !HIBERNATION |
28 | depends on ARCH_SUPPORTS_DEBUG_PAGEALLOC | ||
28 | help | 29 | help |
29 | Unmap pages from the kernel linear mapping after free_pages(). | 30 | Unmap pages from the kernel linear mapping after free_pages(). |
30 | This results in a large slowdown, but helps to find certain types | 31 | This results in a large slowdown, but helps to find certain types |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 45161b816313..748e50a1a152 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -165,6 +165,9 @@ config AUDIT_ARCH | |||
165 | config ARCH_SUPPORTS_OPTIMIZED_INLINING | 165 | config ARCH_SUPPORTS_OPTIMIZED_INLINING |
166 | def_bool y | 166 | def_bool y |
167 | 167 | ||
168 | config ARCH_SUPPORTS_DEBUG_PAGEALLOC | ||
169 | def_bool y | ||
170 | |||
168 | # Use the generic interrupt handling code in kernel/irq/: | 171 | # Use the generic interrupt handling code in kernel/irq/: |
169 | config GENERIC_HARDIRQS | 172 | config GENERIC_HARDIRQS |
170 | bool | 173 | bool |
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index fdb45df608b6..a345cb5447a8 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -75,6 +75,7 @@ config DEBUG_STACK_USAGE | |||
75 | config DEBUG_PAGEALLOC | 75 | config DEBUG_PAGEALLOC |
76 | bool "Debug page memory allocations" | 76 | bool "Debug page memory allocations" |
77 | depends on DEBUG_KERNEL | 77 | depends on DEBUG_KERNEL |
78 | depends on ARCH_SUPPORTS_DEBUG_PAGEALLOC | ||
78 | ---help--- | 79 | ---help--- |
79 | Unmap pages from the kernel linear mapping after free_pages(). | 80 | Unmap pages from the kernel linear mapping after free_pages(). |
80 | This results in a large slowdown, but helps to find certain types | 81 | This results in a large slowdown, but helps to find certain types |