Skip to content

Commit 2abfcdf

Browse files
Levin, Alexander (Sasha Levin)gregkh
authored andcommitted
kmemcheck: remove annotations
commit 4950276 upstream. Patch series "kmemcheck: kill kmemcheck", v2. As discussed at LSF/MM, kill kmemcheck. KASan is a replacement that is able to work without the limitation of kmemcheck (single CPU, slow). KASan is already upstream. We are also not aware of any users of kmemcheck (or users who don't consider KASan as a suitable replacement). The only objection was that since KASAN wasn't supported by all GCC versions provided by distros at that time we should hold off for 2 years, and try again. Now that 2 years have passed, and all distros provide gcc that supports KASAN, kill kmemcheck again for the very same reasons. This patch (of 4): Remove kmemcheck annotations, and calls to kmemcheck from the kernel. [alexander.levin@verizon.com: correctly remove kmemcheck call from dma_map_sg_attrs] Link: http://lkml.kernel.org/r/20171012192151.26531-1-alexander.levin@verizon.com Link: http://lkml.kernel.org/r/20171007030159.22241-2-alexander.levin@verizon.com Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Cc: Alexander Potapenko <glider@google.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Michal Hocko <mhocko@kernel.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Tim Hansen <devtimhansen@gmail.com> Cc: Vegard Nossum <vegardno@ifi.uio.no> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1fed58f commit 2abfcdf

34 files changed

Lines changed: 2 additions & 152 deletions

File tree

‎arch/arm/include/asm/dma-iommu.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <linux/mm_types.h>
88
#include <linux/scatterlist.h>
99
#include <linux/dma-debug.h>
10-
#include <linux/kmemcheck.h>
1110
#include <linux/kref.h>
1211

1312
#define ARM_MAPPING_ERROR (~(dma_addr_t)0x0)

‎arch/openrisc/include/asm/dma-mapping.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424

2525
#include <linux/dma-debug.h>
26-
#include <linux/kmemcheck.h>
2726
#include <linux/dma-mapping.h>
2827

2928
extern const struct dma_map_ops or1k_dma_map_ops;

‎arch/x86/Makefile‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,6 @@ ifdef CONFIG_X86_X32
158158
endif
159159
export CONFIG_X86_X32_ABI
160160

161-
# Don't unroll struct assignments with kmemcheck enabled
162-
ifeq ($(CONFIG_KMEMCHECK),y)
163-
KBUILD_CFLAGS += $(call cc-option,-fno-builtin-memcpy)
164-
endif
165-
166161
#
167162
# If the function graph tracer is used with mcount instead of fentry,
168163
# '-maccumulate-outgoing-args' is needed to prevent a GCC bug

‎arch/x86/include/asm/dma-mapping.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* Documentation/DMA-API.txt for documentation.
88
*/
99

10-
#include <linux/kmemcheck.h>
1110
#include <linux/scatterlist.h>
1211
#include <linux/dma-debug.h>
1312
#include <asm/io.h>

‎arch/x86/include/asm/xor.h‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
#ifdef CONFIG_KMEMCHECK
2-
/* kmemcheck doesn't handle MMX/SSE/SSE2 instructions */
3-
# include <asm-generic/xor.h>
4-
#elif !defined(_ASM_X86_XOR_H)
1+
#ifndef _ASM_X86_XOR_H
52
#define _ASM_X86_XOR_H
63

74
/*

‎arch/x86/kernel/traps.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#include <linux/edac.h>
4343
#endif
4444

45-
#include <asm/kmemcheck.h>
4645
#include <asm/stacktrace.h>
4746
#include <asm/processor.h>
4847
#include <asm/debugreg.h>
@@ -764,10 +763,6 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
764763
if (!dr6 && user_mode(regs))
765764
user_icebp = 1;
766765

767-
/* Catch kmemcheck conditions! */
768-
if ((dr6 & DR_STEP) && kmemcheck_trap(regs))
769-
goto exit;
770-
771766
/* Store the virtualized DR6 value */
772767
tsk->thread.debugreg6 = dr6;
773768

‎arch/x86/mm/fault.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <asm/cpufeature.h> /* boot_cpu_has, ... */
2121
#include <asm/traps.h> /* dotraplinkage, ... */
2222
#include <asm/pgalloc.h> /* pgd_*(), ... */
23-
#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
2423
#include <asm/fixmap.h> /* VSYSCALL_ADDR */
2524
#include <asm/vsyscall.h> /* emulate_vsyscall */
2625
#include <asm/vm86.h> /* struct vm86 */
@@ -1257,8 +1256,6 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code,
12571256
* Detect and handle instructions that would cause a page fault for
12581257
* both a tracked kernel page and a userspace page.
12591258
*/
1260-
if (kmemcheck_active(regs))
1261-
kmemcheck_hide(regs);
12621259
prefetchw(&mm->mmap_sem);
12631260

12641261
if (unlikely(kmmio_fault(regs, address)))
@@ -1281,9 +1278,6 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code,
12811278
if (!(error_code & (X86_PF_RSVD | X86_PF_USER | X86_PF_PROT))) {
12821279
if (vmalloc_fault(address) >= 0)
12831280
return;
1284-
1285-
if (kmemcheck_fault(regs, address, error_code))
1286-
return;
12871281
}
12881282

12891283
/* Can handle a stale RO->RW TLB: */

‎drivers/char/random.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@
259259
#include <linux/cryptohash.h>
260260
#include <linux/fips.h>
261261
#include <linux/ptrace.h>
262-
#include <linux/kmemcheck.h>
263262
#include <linux/workqueue.h>
264263
#include <linux/irq.h>
265264
#include <linux/syscalls.h>

‎drivers/misc/c2port/core.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <linux/errno.h>
1616
#include <linux/err.h>
1717
#include <linux/kernel.h>
18-
#include <linux/kmemcheck.h>
1918
#include <linux/ctype.h>
2019
#include <linux/delay.h>
2120
#include <linux/idr.h>
@@ -904,7 +903,6 @@ struct c2port_device *c2port_device_register(char *name,
904903
return ERR_PTR(-EINVAL);
905904

906905
c2dev = kmalloc(sizeof(struct c2port_device), GFP_KERNEL);
907-
kmemcheck_annotate_bitfield(c2dev, flags);
908906
if (unlikely(!c2dev))
909907
return ERR_PTR(-ENOMEM);
910908

‎fs/dcache.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,8 +2705,6 @@ static void swap_names(struct dentry *dentry, struct dentry *target)
27052705
*/
27062706
unsigned int i;
27072707
BUILD_BUG_ON(!IS_ALIGNED(DNAME_INLINE_LEN, sizeof(long)));
2708-
kmemcheck_mark_initialized(dentry->d_iname, DNAME_INLINE_LEN);
2709-
kmemcheck_mark_initialized(target->d_iname, DNAME_INLINE_LEN);
27102708
for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) {
27112709
swap(((long *) &dentry->d_iname)[i],
27122710
((long *) &target->d_iname)[i]);

0 commit comments

Comments
 (0)