[PATCH 07/15] x86/ftrace: Use function_nocfi in MCOUNT_ADDR
From: Sami Tolvanen
Date: Fri Apr 16 2021 - 16:39:16 EST
With CONFIG_CFI_CLANG, the compiler replaces the __fentry__ address in
MCOUNT_ADDR with the address of a CFI jump table. Use function_nocfi()
to get the actual function address.
Signed-off-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
---
arch/x86/include/asm/ftrace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index 9f3130f40807..0b7567994f4a 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -6,7 +6,7 @@
#ifndef CC_USING_FENTRY
# error Compiler does not support fentry?
#endif
-# define MCOUNT_ADDR ((unsigned long)(__fentry__))
+# define MCOUNT_ADDR ((unsigned long)(function_nocfi(__fentry__)))
#define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */
#ifdef CONFIG_DYNAMIC_FTRACE
--
2.31.1.368.gbe11c130af-goog