diff options
| author | Levin, Alexander (Sasha Levin) <alexander.levin@verizon.com> | 2017-11-15 20:36:02 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-15 21:21:05 -0500 |
| commit | 4675ff05de2d76d167336b368bd07f3fef6ed5a6 (patch) | |
| tree | 212d8adf40e13c2a27ac7834d14ca4900923b98c | |
| parent | d8be75663cec0069b85f80191abd2682ce4a512f (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>
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 @@ | |||
| 1 | Getting started with kmemcheck | ||
| 2 | ============================== | ||
| 3 | |||
| 4 | Vegard Nossum <vegardno@ifi.uio.no> | ||
| 5 | |||
| 6 | |||
| 7 | Introduction | ||
| 8 | ------------ | ||
| 9 | |||
| 10 | kmemcheck is a debugging feature for the Linux Kernel. More specifically, it | ||
| 11 | is a dynamic checker that detects and warns about some uses of uninitialized | ||
| 12 | memory. | ||
| 13 | |||
| 14 | Userspace programmers might be familiar with Valgrind's memcheck. The main | ||
| 15 | difference between memcheck and kmemcheck is that memcheck works for userspace | ||
| 16 | programs only, and kmemcheck works for the kernel only. The implementations | ||
| 17 | are of course vastly different. Because of this, kmemcheck is not as accurate | ||
| 18 | as memcheck, but it turns out to be good enough in practice to discover real | ||
| 19 | programmer errors that the compiler is not able to find through static | ||
| 20 | analysis. | ||
| 21 | |||
| 22 | Enabling kmemcheck on a kernel will probably slow it down to the extent that | ||
| 23 | the machine will not be usable for normal workloads such as e.g. an | ||
| 24 | interactive desktop. kmemcheck will also cause the kernel to use about twice | ||
| 25 | as much memory as normal. For this reason, kmemcheck is strictly a debugging | ||
| 26 | feature. | ||
| 27 | |||
| 28 | |||
| 29 | Downloading | ||
| 30 | ----------- | ||
| 31 | |||
| 32 | As of version 2.6.31-rc1, kmemcheck is included in the mainline kernel. | ||
| 33 | |||
| 34 | |||
| 35 | Configuring and compiling | ||
| 36 | ------------------------- | ||
| 37 | |||
| 38 | kmemcheck only works for the x86 (both 32- and 64-bit) platform. A number of | ||
| 39 | configuration variables must have specific settings in order for the kmemcheck | ||
| 40 | menu 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 | |||
| 70 | In addition, I highly recommend turning on ``CONFIG_DEBUG_INFO=y``. This is also | ||
| 71 | located under "Kernel hacking". With this, you will be able to get line number | ||
| 72 | information from the kmemcheck warnings, which is extremely valuable in | ||
| 73 | debugging a problem. This option is not mandatory, however, because it slows | ||
| 74 | down the compilation process and produces a much bigger kernel image. | ||
| 75 | |||
| 76 | Now the kmemcheck menu should be visible (under "Kernel hacking" / "Memory | ||
| 77 | Debugging" / "kmemcheck: trap use of uninitialized memory"). Here follows | ||
| 78 | a 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 | ||
