Skip to content

Commit 7585172

Browse files
dvyukovtorvalds
authored andcommitted
arm: port KCOV to arm
KCOV is code coverage collection facility used, in particular, by syzkaller system call fuzzer. There is some interest in using syzkaller on arm devices. So port KCOV to arm. On implementation level this merely declares that KCOV is supported and disables instrumentation of 3 special cases. Reasons for disabling are commented in code. Tested with qemu-system-arm/vexpress-a15. Link: http://lkml.kernel.org/r/20180511143248.112484-1-dvyukov@google.com Signed-off-by: Dmitry Vyukov <dvyukov@google.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Cc: Russell King <linux@armlinux.org.uk> Cc: Abbott Liu <liuwenliang@huawei.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Koguchi Takuo <takuo.koguchi.sw@hitachi.com> Cc: <syzkaller@googlegroups.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 0ed557a commit 7585172

4 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎arch/arm/Kconfig‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ config ARM
88
select ARCH_HAS_DEVMEM_IS_ALLOWED
99
select ARCH_HAS_ELF_RANDOMIZE
1010
select ARCH_HAS_FORTIFY_SOURCE
11+
select ARCH_HAS_KCOV
1112
select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
12-
select ARCH_HAS_SET_MEMORY
1313
select ARCH_HAS_PHYS_TO_DMA
14+
select ARCH_HAS_SET_MEMORY
1415
select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
1516
select ARCH_HAS_STRICT_MODULE_RWX if MMU
1617
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST

‎arch/arm/boot/compressed/Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ endif
2525

2626
GCOV_PROFILE := n
2727

28+
# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
29+
KCOV_INSTRUMENT := n
30+
2831
#
2932
# Architecture dependencies
3033
#

‎arch/arm/kvm/hyp/Makefile‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ obj-$(CONFIG_KVM_ARM_HOST) += hyp-entry.o
2323
obj-$(CONFIG_KVM_ARM_HOST) += switch.o
2424
CFLAGS_switch.o += $(CFLAGS_ARMV7VE)
2525
obj-$(CONFIG_KVM_ARM_HOST) += s2-setup.o
26+
27+
# KVM code is run at a different exception code with a different map, so
28+
# compiler instrumentation that inserts callbacks or checks into the code may
29+
# cause crashes. Just disable it.
30+
GCOV_PROFILE := n
31+
KASAN_SANITIZE := n
32+
UBSAN_SANITIZE := n
33+
KCOV_INSTRUMENT := n

‎arch/arm/vdso/Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ CFLAGS_vgettimeofday.o = -O2
3030
# Disable gcov profiling for VDSO code
3131
GCOV_PROFILE := n
3232

33+
# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
34+
KCOV_INSTRUMENT := n
35+
3336
# Force dependency
3437
$(obj)/vdso.o : $(obj)/vdso.so
3538

0 commit comments

Comments
 (0)