34 lines
1020 B
Diff
34 lines
1020 B
Diff
From ab2397c03e31f0f697aa8bf943d70b4e5a7def54 Mon Sep 17 00:00:00 2001
|
|
From: Josh Poimboeuf <jpoimboe@redhat.com>
|
|
Date: Mon, 21 Nov 2022 19:41:30 -0800
|
|
Subject: [PATCH] kpatch-macros: add KPATCH_STATIC_CALL()
|
|
|
|
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
|
|
---
|
|
kmod/patch/kpatch-macros.h | 11 +++++++++++
|
|
1 file changed, 11 insertions(+)
|
|
|
|
diff --git a/kmod/patch/kpatch-macros.h b/kmod/patch/kpatch-macros.h
|
|
index 8e09702..b797838 100644
|
|
--- a/kmod/patch/kpatch-macros.h
|
|
+++ b/kmod/patch/kpatch-macros.h
|
|
@@ -141,4 +141,15 @@ struct kpatch_post_unpatch_callback {
|
|
printk(_fmt, ## __VA_ARGS__); \
|
|
})
|
|
|
|
+/*
|
|
+ * KPATCH_STATIC_CALL macro
|
|
+ *
|
|
+ * Replace usages of static_call() with this macro, when create-diff-object
|
|
+ * recommends it due to the original static call key living in a module.
|
|
+ *
|
|
+ * This converts the static call to a regular indirect call.
|
|
+ */
|
|
+#define KPATCH_STATIC_CALL(name) \
|
|
+ ((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))
|
|
+
|
|
#endif /* __KPATCH_MACROS_H_ */
|
|
--
|
|
2.27.0
|
|
|