linux-stable/arch
Marco Elver bece04b5b4 kcov: fix generic Kconfig dependencies if ARCH_WANTS_NO_INSTR
Until recent versions of GCC and Clang, it was not possible to disable
KCOV instrumentation via a function attribute.  The relevant function
attribute was introduced in 540540d06e ("kcov: add
__no_sanitize_coverage to fix noinstr for all architectures").

x86 was the first architecture to want a working noinstr, and at the
time no compiler support for the attribute existed yet.  Therefore,
commit 0f1441b44e ("objtool: Fix noinstr vs KCOV") introduced the
ability to NOP __sanitizer_cov_*() calls in .noinstr.text.

However, this doesn't work for other architectures like arm64 and s390
that want a working noinstr per ARCH_WANTS_NO_INSTR.

At the time of 0f1441b44e, we didn't yet have ARCH_WANTS_NO_INSTR,
but now we can move the Kconfig dependency checks to the generic KCOV
option.  KCOV will be available if:

	- architecture does not care about noinstr, OR
	- we have objtool support (like on x86), OR
	- GCC is 12.0 or newer, OR
	- Clang is 13.0 or newer.

Link: https://lkml.kernel.org/r/20211201152604.3984495-1-elver@google.com
Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-01-20 08:52:55 +02:00
..
alpha futex: Wireup futex_waitv syscall 2021-11-25 14:26:12 +01:00
arc Add linux/cacheflush.h 2021-11-17 10:36:15 -05:00
arm SoC: One more fix for 5.16 2022-01-09 10:43:16 -08:00
arm64 mm: percpu: generalize percpu related config 2022-01-20 08:52:52 +02:00
csky csky: fix typo of fpu config macro 2021-12-08 14:15:54 +08:00
h8300
hexagon hexagon: ignore vmlinux.lds 2021-11-20 10:35:54 -08:00
ia64 mm: percpu: generalize percpu related config 2022-01-20 08:52:52 +02:00
m68k asm-generic: syscall table updates 2021-11-25 10:41:28 -08:00
microblaze futex: Wireup futex_waitv syscall 2021-11-25 14:26:12 +01:00
mips mm: percpu: add generic pcpu_fc_alloc/free funciton 2022-01-20 08:52:52 +02:00
nds32 Add linux/cacheflush.h 2021-11-17 10:36:15 -05:00
nios2 Add linux/cacheflush.h 2021-11-17 10:36:15 -05:00
openrisc
parisc parisc: remove ARCH_DEFCONFIG 2021-12-22 09:02:10 +01:00
powerpc mm: percpu: add generic pcpu_populate_pte() function 2022-01-20 08:52:52 +02:00
riscv mm: percpu: generalize percpu related config 2022-01-20 08:52:52 +02:00
s390 s390/entry: fix duplicate tracking of irq nesting level 2021-12-12 18:52:26 +01:00
sh asm-generic: syscall table updates 2021-11-25 10:41:28 -08:00
sparc proc: make the proc_create[_data]() stubs static inlines 2022-01-20 08:52:52 +02:00
um
x86 kcov: fix generic Kconfig dependencies if ARCH_WANTS_NO_INSTR 2022-01-20 08:52:55 +02:00
xtensa asm-generic: syscall table updates 2021-11-25 10:41:28 -08:00
.gitignore
Kconfig arch/Kconfig: split PAGE_SIZE_LESS_THAN_256KB from PAGE_SIZE_LESS_THAN_64KB 2022-01-20 08:52:55 +02:00