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