aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLevin, Alexander (Sasha Levin) <alexander.levin@verizon.com>2017-11-15 20:36:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-15 21:21:05 -0500
commit4675ff05de2d76d167336b368bd07f3fef6ed5a6 (patch)
tree212d8adf40e13c2a27ac7834d14ca4900923b98c
parentd8be75663cec0069b85f80191abd2682ce4a512f (diff)
kmemcheck: rip it out
Fix up makefiles, remove references, and git rm kmemcheck. Link: http://lkml.kernel.org/r/20171007030159.22241-4-alexander.levin@verizon.com Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Vegard Nossum <vegardno@ifi.uio.no> Cc: Pekka Enberg <penberg@kernel.org> Cc: Michal Hocko <mhocko@kernel.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Alexander Potapenko <glider@google.com> Cc: Tim Hansen <devtimhansen@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt7
-rw-r--r--Documentation/dev-tools/index.rst1
-rw-r--r--Documentation/dev-tools/kmemcheck.rst733
-rw-r--r--MAINTAINERS10
-rw-r--r--arch/x86/Kconfig3
-rw-r--r--arch/x86/include/asm/kmemcheck.h42
-rw-r--r--arch/x86/include/asm/string_32.h9
-rw-r--r--arch/x86/include/asm/string_64.h8
-rw-r--r--arch/x86/kernel/cpu/intel.c15
-rw-r--r--arch/x86/mm/Makefile2
-rw-r--r--arch/x86/mm/init.c5
-rw-r--r--arch/x86/mm/kmemcheck/Makefile1
-rw-r--r--arch/x86/mm/kmemcheck/error.c227
-rw-r--r--arch/x86/mm/kmemcheck/error.h15
-rw-r--r--arch/x86/mm/kmemcheck/kmemcheck.c658
-rw-r--r--arch/x86/mm/kmemcheck/opcode.c106
-rw-r--r--arch/x86/mm/kmemcheck/opcode.h9
-rw-r--r--arch/x86/mm/kmemcheck/pte.c22
-rw-r--r--arch/x86/mm/kmemcheck/pte.h10
-rw-r--r--arch/x86/mm/kmemcheck/selftest.c70
-rw-r--r--arch/x86/mm/kmemcheck/selftest.h6
-rw-r--r--arch/x86/mm/kmemcheck/shadow.c173
-rw-r--r--arch/x86/mm/kmemcheck/shadow.h18
-rw-r--r--include/linux/interrupt.h15
-rw-r--r--include/linux/kmemcheck.h171
-rw-r--r--kernel/softirq.c10
-rw-r--r--kernel/sysctl.c10
-rw-r--r--lib/Kconfig.debug6
-rw-r--r--lib/Kconfig.kmemcheck94
-rw-r--r--mm/Kconfig.debug1
-rw-r--r--mm/Makefile2
-rw-r--r--mm/kmemcheck.c125
-rw-r--r--mm/slub.c5
-rwxr-xr-xscripts/kernel-doc2
-rw-r--r--tools/include/linux/kmemcheck.h8
35 files changed, 7 insertions, 2592 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index b74e13312fdc..00bb04972612 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1864,13 +1864,6 @@
1864 Built with CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y, 1864 Built with CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y,
1865 the default is off. 1865 the default is off.
1866 1866
1867 kmemcheck= [X86] Boot-time kmemcheck enable/disable/one-shot mode
1868 Valid arguments: 0, 1, 2
1869 kmemcheck=0 (disabled)
1870 kmemcheck=1 (enabled)
1871 kmemcheck=2 (one-shot mode)
1872 Default: 2 (one-shot mode)
1873
1874 kvm.ignore_msrs=[KVM] Ignore guest accesses to unhandled MSRs. 1867 kvm.ignore_msrs=[KVM] Ignore guest accesses to unhandled MSRs.
1875 Default is 0 (don't ignore, but inject #GP) 1868 Default is 0 (don't ignore, but inject #GP)
1876 1869
diff --git a/Documentation/dev-tools/index.rst b/Documentation/dev-tools/index.rst
index a81787cd47d7..e313925fb0fa 100644
--- a/Documentation/dev-tools/index.rst
+++ b/Documentation/dev-tools/index.rst
@@ -21,7 +21,6 @@ whole; patches welcome!
21 kasan 21 kasan
22 ubsan 22 ubsan
23 kmemleak 23 kmemleak
24 kmemcheck
25 gdb-kernel-debugging 24 gdb-kernel-debugging
26 kgdb 25 kgdb
27 kselftest 26 kselftest
diff --git a/Documentation/dev-tools/kmemcheck.rst b/Documentation/dev-tools/kmemcheck.rst
deleted file mode 100644
index 7f3d1985de74..000000000000
--- a/Documentation/dev-tools/kmemcheck.rst
+++ /dev/null
@@ -1,733 +0,0 @@
1Getting started with kmemcheck
2==============================
3
4Vegard Nossum <vegardno@ifi.uio.no>
5
6
7Introduction
8------------
9
10kmemcheck is a debugging feature for the Linux Kernel. More specifically, it
11is a dynamic checker that detects and warns about some uses of uninitialized
12memory.
13
14Userspace programmers might be familiar with Valgrind's memcheck. The main
15difference between memcheck and kmemcheck is that memcheck works for userspace
16programs only, and kmemcheck works for the kernel only. The implementations
17are of course vastly different. Because of this, kmemcheck is not as accurate
18as memcheck, but it turns out to be good enough in practice to discover real
19programmer errors that the compiler is not able to find through static
20analysis.
21
22Enabling kmemcheck on a kernel will probably slow it down to the extent that
23the machine will not be usable for normal workloads such as e.g. an
24interactive desktop. kmemcheck will also cause the kernel to use about twice
25as much memory as normal. For this reason, kmemcheck is strictly a debugging
26feature.
27
28
29Downloading
30-----------
31
32As of version 2.6.31-rc1, kmemcheck is included in the mainline kernel.
33
34
35Configuring and compiling
36-------------------------
37
38kmemcheck only works for the x86 (both 32- and 64-bit) platform. A number of
39configuration variables must have specific settings in order for the kmemcheck
40menu to even appear in "menuconfig". These are:
41
42- ``CONFIG_CC_OPTIMIZE_FOR_SIZE=n``
43 This option is located under "General setup" / "Optimize for size".
44
45 Without this, gcc will use certain optimizations that usually lead to
46 false positive warnings from kmemcheck. An example of this is a 16-bit
47 field in a struct, where gcc may load 32 bits, then discard the upper
48 16 bits. kmemcheck sees only the 32-bit load, and may trigger a
49 warning for the upper 16 bits (if they're uninitialized).
50
51- ``CONFIG_SLAB=y`` or ``CONFIG_SLUB=y``
52 This option is located under "General setup" / "Choose SLAB
53 allocator".
54
55- ``CONFIG_FUNCTION_TRACER=n``
56 This option is located under "Kernel hacking" / "Tracers" / "Kernel
57 Function Tracer"
58
59 When function tracing is compiled in, gcc emits a call to another
60 function at the beginning of every function. This means that when the
61 page fault handler is called, the ftrace framework will be called
62 before kmemcheck has had a chance to handle the fault. If ftrace then
63 modifies memory that was tracked by kmemcheck, the result is an
64 endless recursive page fault.
65
66- ``CONFIG_DEBUG_PAGEALLOC=n``
67 This option is located under "Kernel hacking" / "Memory Debugging"
68 / "Debug page memory allocations".
69
70In addition, I highly recommend turning on ``CONFIG_DEBUG_INFO=y``. This is also
71located under "Kernel hacking". With this, you will be able to get line number
72information from the kmemcheck warnings, which is extremely valuable in
73debugging a problem. This option is not mandatory, however, because it slows
74down the compilation process and produces a much bigger kernel image.
75
76Now the kmemcheck menu should be visible (under "Kernel hacking" / "Memory
77Debugging" / "kmemcheck: trap use of uninitialized memory"). Here follows
78a description of the kmemcheck configuration variables:
79
80- ``CONFIG_KMEMCHECK``
81 This must be enabled in order to use kmemcheck at all...
82
83- ``CONFIG_KMEMCHECK_``[``DISABLED`` | ``ENABLED`` | ``ONESHOT``]``_BY_DEFAULT``
84 This option controls the status of kmemcheck at boot-time. "Enabled"
85 will enable kmemcheck right from the start, "disabled" will boot the
86 kernel as normal (but with the kmemcheck code compiled in, so it can
87 be enabled at run-time after the kernel has booted), and "one-shot" is
88 a special mode which will turn kmemcheck off automatically after
89 detecting the first use of uninitialized memory.
90
91 If you are using kmemcheck to actively debug a problem, then you
92 probably want to choose "enabled" here.
93
94 The one-shot mode is mostly useful in automated test setups because it
95 can prevent floods of warnings and increase the chances of the machine
96 surviving in case something is really wrong. In other cases, the one-
97 shot mode could actually be counter-productive because it would turn
98 itself off at the very first error -- in the case of a false positive
99 too -- and this would come in the way of debugging the specific
100 problem you were interested in.
101
102 If you would like to use your kernel as normal, but with a chance to
103 enable kmemcheck in case of some problem, it might be a good idea to
104 choose "disabled" here. When kmemcheck is disabled, most of the run-
105 time overhead is not incurred, and the kernel will be almost as fast
106 as normal.
107
108- ``CONFIG_KMEMCHECK_QUEUE_SIZE``
109 Select the maximum number of error reports to store in an internal
110 (fixed-size) buffer. Since errors can occur virtually anywhere and in
111 any context, we need a temporary storage area which is guaranteed not
112 to generate any other page faults when accessed. The queue will be