]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/cfi: Only define poison_cfi() if CONFIG_X86_KERNEL_IBT=y
authorIngo Molnar <mingo@kernel.org>
Tue, 11 Jul 2023 08:10:40 +0000 (10:10 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 11 Jul 2023 08:17:55 +0000 (10:17 +0200)
poison_cfi() was introduced in:

  9831c6253ace ("x86/cfi: Extend ENDBR sealing to kCFI")

... but it's only ever used under CONFIG_X86_KERNEL_IBT=y,
and if that option is disabled, we get:

  arch/x86/kernel/alternative.c:1243:13: error: ‘poison_cfi’ defined but not used [-Werror=unused-function]

Guard the definition with CONFIG_X86_KERNEL_IBT.

Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/alternative.c

index d77aaabf9fe8e5d1326149df897cc05dcd326cc9..2dcf3a06af0908b6dc67594daff54d7555b9fc83 100644 (file)
@@ -1240,7 +1240,9 @@ static void __apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
 {
 }
 
+#ifdef CONFIG_X86_KERNEL_IBT
 static void poison_cfi(void *addr) { }
+#endif
 
 #endif