1config HAVE_ARCH_KMEMCHECK
2	bool
3
4if HAVE_ARCH_KMEMCHECK
5
6menuconfig KMEMCHECK
7	bool "kmemcheck: trap use of uninitialized memory"
8	depends on DEBUG_KERNEL
9	depends on !X86_USE_3DNOW
10	depends on SLUB || SLAB
11	depends on !CC_OPTIMIZE_FOR_SIZE
12	depends on !FUNCTION_TRACER
13	select FRAME_POINTER
14	select STACKTRACE
15	default n
16	help
17	  This option enables tracing of dynamically allocated kernel memory
18	  to see if memory is used before it has been given an initial value.
19	  Be aware that this requires half of your memory for bookkeeping and
20	  will insert extra code at *every* read and write to tracked memory
21	  thus slow down the kernel code (but user code is unaffected).
22
23	  The kernel may be started with kmemcheck=0 or kmemcheck=1 to disable
24	  or enable kmemcheck at boot-time. If the kernel is started with
25	  kmemcheck=0, the large memory and CPU overhead is not incurred.
26
27choice
28	prompt "kmemcheck: default mode at boot"
29	depends on KMEMCHECK
30	default KMEMCHECK_ONESHOT_BY_DEFAULT
31	help
32	  This option controls the default behaviour of kmemcheck when the
33	  kernel boots and no kmemcheck= parameter is given.
34
35config KMEMCHECK_DISABLED_BY_DEFAULT
36	bool "disabled"
37	depends on KMEMCHECK
38
39config KMEMCHECK_ENABLED_BY_DEFAULT
40	bool "enabled"
41	depends on KMEMCHECK
42
43config KMEMCHECK_ONESHOT_BY_DEFAULT
44	bool "one-shot"
45	depends on KMEMCHECK
46	help
47	  In one-shot mode, only the first error detected is reported before
48	  kmemcheck is disabled.
49
50endchoice
51
52config KMEMCHECK_QUEUE_SIZE
53	int "kmemcheck: error queue size"
54	depends on KMEMCHECK
55	default 64
56	help
57	  Select the maximum number of errors to store in the queue. Since
58	  errors can occur virtually anywhere and in any context, we need a
59	  temporary storage area which is guarantueed not to generate any
60	  other faults. The queue will be emptied as soon as a tasklet may
61	  be scheduled. If the queue is full, new error reports will be
62	  lost.
63
64config KMEMCHECK_SHADOW_COPY_SHIFT
65	int "kmemcheck: shadow copy size (5 => 32 bytes, 6 => 64 bytes)"
66	depends on KMEMCHECK
67	range 2 8
68	default 5
69	help
70	  Select the number of shadow bytes to save along with each entry of
71	  the queue. These bytes indicate what parts of an allocation are
72	  initialized, uninitialized, etc. and will be displayed when an
73	  error is detected to help the debugging of a particular problem.
74
75config KMEMCHECK_PARTIAL_OK
76	bool "kmemcheck: allow partially uninitialized memory"
77	depends on KMEMCHECK
78	default y
79	help
80	  This option works around certain GCC optimizations that produce
81	  32-bit reads from 16-bit variables where the upper 16 bits are
82	  thrown away afterwards. This may of course also hide some real
83	  bugs.
84
85config KMEMCHECK_BITOPS_OK
86	bool "kmemcheck: allow bit-field manipulation"
87	depends on KMEMCHECK
88	default n
89	help
90	  This option silences warnings that would be generated for bit-field
91	  accesses where not all the bits are initialized at the same time.
92	  This may also hide some real bugs.
93
94endif
95