Skip to content

Commit 4950276

Browse files
Levin, Alexander (Sasha Levin)torvalds
authored andcommitted
kmemcheck: remove annotations
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. [[email protected]: correctly remove kmemcheck call from dma_map_sg_attrs] Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Eric W. Biederman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Tim Hansen <[email protected]> Cc: Vegard Nossum <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent cdb07bd commit 4950276

File tree

34 files changed

+2
-152
lines changed

34 files changed

+2
-152
lines changed

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>
@@ -749,10 +748,6 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
749748
if (!dr6 && user_mode(regs))
750749
user_icebp = 1;
751750

752-
/* Catch kmemcheck conditions! */
753-
if ((dr6 & DR_STEP) && kmemcheck_trap(regs))
754-
goto exit;
755-
756751
/* Store the virtualized DR6 value */
757752
tsk->thread.debugreg6 = dr6;
758753

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 */
@@ -1256,8 +1255,6 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code,
12561255
* Detect and handle instructions that would cause a page fault for
12571256
* both a tracked kernel page and a userspace page.
12581257
*/
1259-
if (kmemcheck_active(regs))
1260-
kmemcheck_hide(regs);
12611258
prefetchw(&mm->mmap_sem);
12621259

12631260
if (unlikely(kmmio_fault(regs, address)))
@@ -1280,9 +1277,6 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code,
12801277
if (!(error_code & (X86_PF_RSVD | X86_PF_USER | X86_PF_PROT))) {
12811278
if (vmalloc_fault(address) >= 0)
12821279
return;
1283-
1284-
if (kmemcheck_fault(regs, address, error_code))
1285-
return;
12861280
}
12871281

12881282
/* 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)