summaryrefslogtreecommitdiff
path: root/include/linux/ftrace.h
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2018-05-10 14:56:41 -0700
committerBruno Martins <bgcngm@gmail.com>2022-10-28 15:57:24 +0100
commit95b0a5e52f2aa815d377664fed4dce64825f80b6 (patch)
tree5c1cb6573d54a72ac8ffe4cc119970b33cc4c6e9 /include/linux/ftrace.h
parent7da9c2138ec8b05968bd225cd06f6f06b0a67719 (diff)
BACKPORT: ANDROID: ftrace: fix function type mismatches
This change fixes indirect call mismatches with function and function graph tracing, which trip Control-Flow Integrity (CFI) checking. Bug: 79510107 Bug: 67506682 Change-Id: I5de08c113fb970ffefedce93c58e0161f22c7ca2 Signed-off-by: Sami Tolvanen <samitolvanen@google.com> (cherry picked from commit c2f9bce9fee8e31e0500c501076f73db7791d8e9) Signed-off-by: Dan Aloni <daloni@magicleap.com> Signed-off-by: Davide Garberi <dade.garberi@gmail.com>
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r--include/linux/ftrace.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index a85d7b71e329..c0b08bbe85b2 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -244,8 +244,16 @@ static inline int ftrace_function_local_disabled(struct ftrace_ops *ops)
return *this_cpu_ptr(ops->disabled);
}
+#ifdef CONFIG_CFI_CLANG
+/* Use a C stub with the correct type for CFI */
+static inline void ftrace_stub(unsigned long a0, unsigned long a1,
+ struct ftrace_ops *op, struct pt_regs *regs)
+{
+}
+#else
extern void ftrace_stub(unsigned long a0, unsigned long a1,
struct ftrace_ops *op, struct pt_regs *regs);
+#endif
#else /* !CONFIG_FUNCTION_TRACER */
/*