x86/asm: Avoid generating unused kprobe sections
authorKees Cook <keescook@chromium.org>
Fri, 21 Aug 2020 19:43:03 +0000 (12:43 -0700)
committerIngo Molnar <mingo@kernel.org>
Tue, 1 Sep 2020 08:03:18 +0000 (10:03 +0200)
When !CONFIG_KPROBES, do not generate kprobe sections. This makes
sure there are no unexpected sections encountered by the linker scripts.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200821194310.3089815-23-keescook@chromium.org
arch/x86/include/asm/asm.h

index 5c15f95..4712206 100644 (file)
 # define _ASM_EXTABLE_FAULT(from, to)                          \
        _ASM_EXTABLE_HANDLE(from, to, ex_handler_fault)
 
-# define _ASM_NOKPROBE(entry)                                  \
+# ifdef CONFIG_KPROBES
+#  define _ASM_NOKPROBE(entry)                                 \
        .pushsection "_kprobe_blacklist","aw" ;                 \
        _ASM_ALIGN ;                                            \
        _ASM_PTR (entry);                                       \
        .popsection
+# else
+#  define _ASM_NOKPROBE(entry)
+# endif
 
 #else /* ! __ASSEMBLY__ */
 # define _EXPAND_EXTABLE_HANDLE(x) #x