]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
kmemcheck: enable in the x86 Kconfig
authorVegard Nossum <vegard.nossum@gmail.com>
Thu, 3 Apr 2008 22:51:41 +0000 (00:51 +0200)
committerVegard Nossum <vegard.nossum@gmail.com>
Mon, 15 Jun 2009 13:49:15 +0000 (15:49 +0200)
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>
arch/x86/Kconfig.debug
lib/Kconfig.debug
mm/Kconfig.debug

index d105f29bb6bb7c9b75fe3369d66f68f2f3ada5ba..3951ebb5f8439e281d97ecf17e88b1b9a3662149 100644 (file)
@@ -260,6 +260,94 @@ config DEFAULT_IO_DELAY_TYPE
        default IO_DELAY_TYPE_NONE
 endif
 
+menuconfig KMEMCHECK
+       bool "kmemcheck: trap use of uninitialized memory"
+       depends on DEBUG_KERNEL
+       depends on !X86_USE_3DNOW
+       depends on SLUB || SLAB
+       depends on !CC_OPTIMIZE_FOR_SIZE
+       depends on !FUNCTION_TRACER
+       select FRAME_POINTER
+       select STACKTRACE
+       default n
+       help
+         This option enables tracing of dynamically allocated kernel memory
+         to see if memory is used before it has been given an initial value.
+         Be aware that this requires half of your memory for bookkeeping and
+         will insert extra code at *every* read and write to tracked memory
+         thus slow down the kernel code (but user code is unaffected).
+
+         The kernel may be started with kmemcheck=0 or kmemcheck=1 to disable
+         or enable kmemcheck at boot-time. If the kernel is started with
+         kmemcheck=0, the large memory and CPU overhead is not incurred.
+
+choice
+       prompt "kmemcheck: default mode at boot"
+       depends on KMEMCHECK
+       default KMEMCHECK_ONESHOT_BY_DEFAULT
+       help
+         This option controls the default behaviour of kmemcheck when the
+         kernel boots and no kmemcheck= parameter is given.
+
+config KMEMCHECK_DISABLED_BY_DEFAULT
+       bool "disabled"
+       depends on KMEMCHECK
+
+config KMEMCHECK_ENABLED_BY_DEFAULT
+       bool "enabled"
+       depends on KMEMCHECK
+
+config KMEMCHECK_ONESHOT_BY_DEFAULT
+       bool "one-shot"
+       depends on KMEMCHECK
+       help
+         In one-shot mode, only the first error detected is reported before
+         kmemcheck is disabled.
+
+endchoice
+
+config KMEMCHECK_QUEUE_SIZE
+       int "kmemcheck: error queue size"
+       depends on KMEMCHECK
+       default 64
+       help
+         Select the maximum number of errors to store in the queue. Since
+         errors can occur virtually anywhere and in any context, we need a
+         temporary storage area which is guarantueed not to generate any
+         other faults. The queue will be emptied as soon as a tasklet may
+         be scheduled. If the queue is full, new error reports will be
+         lost.
+
+config KMEMCHECK_SHADOW_COPY_SHIFT
+       int "kmemcheck: shadow copy size (5 => 32 bytes, 6 => 64 bytes)"
+       depends on KMEMCHECK
+       range 2 8
+       default 5
+       help
+         Select the number of shadow bytes to save along with each entry of
+         the queue. These bytes indicate what parts of an allocation are
+         initialized, uninitialized, etc. and will be displayed when an
+         error is detected to help the debugging of a particular problem.
+
+config KMEMCHECK_PARTIAL_OK
+       bool "kmemcheck: allow partially uninitialized memory"
+       depends on KMEMCHECK
+       default y
+       help
+         This option works around certain GCC optimizations that produce
+         32-bit reads from 16-bit variables where the upper 16 bits are
+         thrown away afterwards. This may of course also hide some real
+         bugs.
+
+config KMEMCHECK_BITOPS_OK
+       bool "kmemcheck: allow bit-field manipulation"
+       depends on KMEMCHECK
+       default n
+       help
+         This option silences warnings that would be generated for bit-field
+         accesses where not all the bits are initialized at the same time.
+         This may also hide some real bugs.
+
 config DEBUG_BOOT_PARAMS
        bool "Debug boot parameters"
        depends on DEBUG_KERNEL
index 116a35051be6fef457075c18b78e5c4cb17ec58e..399ba811ba18f1690ec05e3213f44589606e1de9 100644 (file)
@@ -300,7 +300,7 @@ config DEBUG_OBJECTS_ENABLE_DEFAULT
 
 config DEBUG_SLAB
        bool "Debug slab memory allocations"
-       depends on DEBUG_KERNEL && SLAB
+       depends on DEBUG_KERNEL && SLAB && !KMEMCHECK
        help
          Say Y here to have the kernel do limited verification on memory
          allocation as well as poisoning memory on free to catch use of freed
@@ -312,7 +312,7 @@ config DEBUG_SLAB_LEAK
 
 config SLUB_DEBUG_ON
        bool "SLUB debugging on by default"
-       depends on SLUB && SLUB_DEBUG
+       depends on SLUB && SLUB_DEBUG && !KMEMCHECK
        default n
        help
          Boot with debugging on by default. SLUB boots by default with
index bb01e298f260b84c82b03acdfb11582e42ecbbe6..aa99fd1f7109f03ef24085dd2ab37e5eb7c72534 100644 (file)
@@ -2,6 +2,7 @@ config DEBUG_PAGEALLOC
        bool "Debug page memory allocations"
        depends on DEBUG_KERNEL && ARCH_SUPPORTS_DEBUG_PAGEALLOC
        depends on !HIBERNATION || !PPC && !SPARC
+       depends on !KMEMCHECK
        ---help---
          Unmap pages from the kernel linear mapping after free_pages().
          This results in a large slowdown, but helps to find certain types