diff options
author | Vegard Nossum <vegard.nossum@gmail.com> | 2008-04-03 18:51:41 -0400 |
---|---|---|
committer | Vegard Nossum <vegard.nossum@gmail.com> | 2009-06-15 09:49:15 -0400 |
commit | 7d46d9e6dbffe8780aa8430a63543d3f7ba92860 (patch) | |
tree | 4475ceed7a49fccd1e2d609aaf181eed87c1e072 | |
parent | b1eeab67682a5e397aecf172046b3a8bd4808ae4 (diff) |
kmemcheck: enable in the x86 Kconfig
let it rip!
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
[rebased for mainline inclusion]
Signed-off-by: Vegard Nossum <vegardno@ifi.uio.no>
-rw-r--r-- | arch/x86/Kconfig.debug | 88 | ||||
-rw-r--r-- | lib/Kconfig.debug | 4 | ||||
-rw-r--r-- | mm/Kconfig.debug | 1 |
3 files changed, 91 insertions, 2 deletions
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index d105f29bb6bb..3951ebb5f843 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -260,6 +260,94 @@ config DEFAULT_IO_DELAY_TYPE | |||
260 | default IO_DELAY_TYPE_NONE | 260 | default IO_DELAY_TYPE_NONE |
261 | endif | 261 | endif |
262 | 262 | ||
263 | menuconfig KMEMCHECK | ||
264 | bool "kmemcheck: trap use of uninitialized memory" | ||
265 | depends on DEBUG_KERNEL | ||
266 | depends on !X86_USE_3DNOW | ||
267 | depends on SLUB || SLAB | ||
268 | depends on !CC_OPTIMIZE_FOR_SIZE | ||
269 | depends on !FUNCTION_TRACER | ||
270 | select FRAME_POINTER | ||
271 | select STACKTRACE | ||
272 | default n | ||
273 | help | ||
274 | This option enables tracing of dynamically allocated kernel memory | ||
275 | to see if memory is used before it has been given an initial value. | ||
276 | Be aware that this requires half of your memory for bookkeeping and | ||
277 | will insert extra code at *every* read and write to tracked memory | ||
278 | thus slow down the kernel code (but user code is unaffected). | ||
279 | |||
280 | The kernel may be started with kmemcheck=0 or kmemcheck=1 to disable | ||
281 | or enable kmemcheck at boot-time. If the kernel is started with | ||
282 | kmemcheck=0, the large memory and CPU overhead is not incurred. | ||
283 | |||
284 | choice | ||
285 | prompt "kmemcheck: default mode at boot" | ||
286 | depends on KMEMCHECK | ||
287 | default KMEMCHECK_ONESHOT_BY_DEFAULT | ||
288 | help | ||
289 | This option controls the default behaviour of kmemcheck when the | ||
290 | kernel boots and no kmemcheck= parameter is given. | ||
291 | |||
292 | config KMEMCHECK_DISABLED_BY_DEFAULT | ||
293 | bool "disabled" | ||
294 | depends on KMEMCHECK | ||
295 | |||
296 | config KMEMCHECK_ENABLED_BY_DEFAULT | ||
297 | bool "enabled" | ||
298 | depends on KMEMCHECK | ||
299 | |||
300 | config KMEMCHECK_ONESHOT_BY_DEFAULT | ||
301 | bool "one-shot" | ||
302 | depends on KMEMCHECK | ||
303 | help | ||
304 | In one-shot mode, only the first error detected is reported before | ||
305 | kmemcheck is disabled. | ||
306 | |||
307 | endchoice | ||
308 | |||
309 | config KMEMCHECK_QUEUE_SIZE | ||
310 | int "kmemcheck: error queue size" | ||
311 | depends on KMEMCHECK | ||
312 | default 64 | ||
313 | help | ||
314 | Select the maximum number of errors to store in the queue. Since | ||
315 | errors can occur virtually anywhere and in any context, we need a | ||
316 | temporary storage area which is guarantueed not to generate any | ||
317 | other faults. The queue will be emptied as soon as a tasklet may | ||
318 | be scheduled. If the queue is full, new error reports will be | ||
319 | lost. | ||
320 | |||
321 | config KMEMCHECK_SHADOW_COPY_SHIFT | ||
322 | int "kmemcheck: shadow copy size (5 => 32 bytes, 6 => 64 bytes)" | ||
323 | depends on KMEMCHECK | ||
324 | range 2 8 | ||
325 | default 5 | ||
326 | help | ||
327 | Select the number of shadow bytes to save along with each entry of | ||
328 | the queue. These bytes indicate what parts of an allocation are | ||
329 | initialized, uninitialized, etc. and will be displayed when an | ||
330 | error is detected to help the debugging of a particular problem. | ||
331 | |||
332 | config KMEMCHECK_PARTIAL_OK | ||
333 | bool "kmemcheck: allow partially uninitialized memory" | ||
334 | depends on KMEMCHECK | ||
335 | default y | ||
336 | help | ||
337 | This option works around certain GCC optimizations that produce | ||
338 | 32-bit reads from 16-bit variables where the upper 16 bits are | ||
339 | thrown away afterwards. This may of course also hide some real | ||
340 | bugs. | ||
341 | |||
342 | config KMEMCHECK_BITOPS_OK | ||
343 | bool "kmemcheck: allow bit-field manipulation" | ||
344 | depends on KMEMCHECK | ||
345 | default n | ||
346 | help | ||
347 | This option silences warnings that would be generated for bit-field | ||
348 | accesses where not all the bits are initialized at the same time. | ||
349 | This may also hide some real bugs. | ||
350 | |||
263 | config DEBUG_BOOT_PARAMS | 351 | config DEBUG_BOOT_PARAMS |
264 | bool "Debug boot parameters" | 352 | bool "Debug boot parameters" |
265 | depends on DEBUG_KERNEL | 353 | depends on DEBUG_KERNEL |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 116a35051be6..399ba811ba18 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -300,7 +300,7 @@ config DEBUG_OBJECTS_ENABLE_DEFAULT | |||
300 | 300 | ||
301 | config DEBUG_SLAB | 301 | config DEBUG_SLAB |
302 | bool "Debug slab memory allocations" | 302 | bool "Debug slab memory allocations" |
303 | depends on DEBUG_KERNEL && SLAB | 303 | depends on DEBUG_KERNEL && SLAB && !KMEMCHECK |
304 | help | 304 | help |
305 | Say Y here to have the kernel do limited verification on memory | 305 | Say Y here to have the kernel do limited verification on memory |
306 | allocation as well as poisoning memory on free to catch use of freed | 306 | allocation as well as poisoning memory on free to catch use of freed |
@@ -312,7 +312,7 @@ config DEBUG_SLAB_LEAK | |||
312 | 312 | ||
313 | config SLUB_DEBUG_ON | 313 | config SLUB_DEBUG_ON |
314 | bool "SLUB debugging on by default" | 314 | bool "SLUB debugging on by default" |
315 | depends on SLUB && SLUB_DEBUG | 315 | depends on SLUB && SLUB_DEBUG && !KMEMCHECK |
316 | default n | 316 | default n |
317 | help | 317 | help |
318 | Boot with debugging on by default. SLUB boots by default with | 318 | Boot with debugging on by default. SLUB boots by default with |
diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index bb01e298f260..aa99fd1f7109 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug | |||
@@ -2,6 +2,7 @@ config DEBUG_PAGEALLOC | |||
2 | bool "Debug page memory allocations" | 2 | bool "Debug page memory allocations" |
3 | depends on DEBUG_KERNEL && ARCH_SUPPORTS_DEBUG_PAGEALLOC | 3 | depends on DEBUG_KERNEL && ARCH_SUPPORTS_DEBUG_PAGEALLOC |
4 | depends on !HIBERNATION || !PPC && !SPARC | 4 | depends on !HIBERNATION || !PPC && !SPARC |
5 | depends on !KMEMCHECK | ||
5 | ---help--- | 6 | ---help--- |
6 | Unmap pages from the kernel linear mapping after free_pages(). | 7 | Unmap pages from the kernel linear mapping after free_pages(). |
7 | This results in a large slowdown, but helps to find certain types | 8 | This results in a large slowdown, but helps to find certain types |