@@ -204,7 +204,8 @@ extern long __static_call_return0(void);
}; \
ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name)
-#define static_call_cond(name, args...) (void)__static_call(name)(args)
+#define static_call_cond(name, args...) \
+ (void)cfi_unchecked(__static_call(name)(args))
#define EXPORT_STATIC_CALL(name) \
EXPORT_SYMBOL(STATIC_CALL_KEY(name)); \
@@ -246,7 +247,8 @@ static inline int static_call_init(void) { return 0; }
}; \
ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name)
-#define static_call_cond(name, args...) (void)__static_call(name)(args)
+#define static_call_cond(name, args...) \
+ (void)cfi_unchecked(__static_call(name)(args))
static inline
void __static_call_update(struct static_call_key *key, void *tramp, void *func)
@@ -81,13 +81,16 @@ struct static_call_key {
#ifdef MODULE
#define __STATIC_CALL_MOD_ADDRESSABLE(name)
-#define static_call_mod(name, args...) __raw_static_call(name)(args)
+#define static_call_mod(name, args...) \
+ cfi_unchecked(__raw_static_call(name)(args))
#else
#define __STATIC_CALL_MOD_ADDRESSABLE(name) __STATIC_CALL_ADDRESSABLE(name)
-#define static_call_mod(name, args...) __static_call(name)(args)
+#define static_call_mod(name, args...) \
+ cfi_unchecked(__static_call(name)(args))
#endif
-#define static_call(name, args...) __static_call(name)(args)
+#define static_call(name, args...) \
+ cfi_unchecked(__static_call(name)(args))
#else
@@ -81,13 +81,16 @@ struct static_call_key {
#ifdef MODULE
#define __STATIC_CALL_MOD_ADDRESSABLE(name)
-#define static_call_mod(name) __raw_static_call(name)
+#define static_call_mod(name, args...) \
+ cfi_unchecked(__raw_static_call(name)(args))
#else
#define __STATIC_CALL_MOD_ADDRESSABLE(name) __STATIC_CALL_ADDRESSABLE(name)
-#define static_call_mod(name) __static_call(name)
+#define static_call_mod(name, args...) \
+ cfi_unchecked(__static_call(name)(args))
#endif
-#define static_call(name) __static_call(name)
+#define static_call(name, args...) \
+ cfi_unchecked(__static_call(name)(args))
#else
@@ -95,8 +98,8 @@ struct static_call_key {
void *func;
};
-#define static_call(name) \
- ((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))
+#define static_call(name, args...) \
+ ((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))(args)
#endif /* CONFIG_HAVE_STATIC_CALL */
With CONFIG_HAVE_STATIC_CALL, static calls are patched into direct calls. Disable indirect call CFI checking for the call sites with the cfi_unchecked macro. Signed-off-by: Sami Tolvanen <samitolvanen@google.com> --- include/linux/static_call.h | 6 ++++-- include/linux/static_call_types.h | 9 ++++++--- tools/include/linux/static_call_types.h | 13 ++++++++----- 3 files changed, 18 insertions(+), 10 deletions(-)