Skip to content

Commit 8fd4ddd

Browse files
chleroyPeter Zijlstra
authored and
Peter Zijlstra
committed
static_call: Don't make __static_call_return0 static
System.map shows that vmlinux contains several instances of __static_call_return0(): c0004fc0 t __static_call_return0 c0011518 t __static_call_return0 c00d8160 t __static_call_return0 arch_static_call_transform() uses the middle one to check whether we are setting a call to __static_call_return0 or not: c0011520 <arch_static_call_transform>: c0011520: 3d 20 c0 01 lis r9,-16383 <== r9 = 0xc001 << 16 c0011524: 39 29 15 18 addi r9,r9,5400 <== r9 += 0x1518 c0011528: 7c 05 48 00 cmpw r5,r9 <== r9 has value 0xc0011518 here So if static_call_update() is called with one of the other instances of __static_call_return0(), arch_static_call_transform() won't recognise it. In order to work properly, global single instance of __static_call_return0() is required. Fixes: 3f2a8fc ("static_call/x86: Add __static_call_return0()") Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Link: https://lkml.kernel.org/r/30821468a0e7d28251954b578e5051dc09300d04.1647258493.git.christophe.leroy@csgroup.eu
1 parent 1cd5f05 commit 8fd4ddd

File tree

4 files changed

+546
-546
lines changed

4 files changed

+546
-546
lines changed

include/linux/static_call.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,7 @@ static inline int static_call_text_reserved(void *start, void *end)
248248
return 0;
249249
}
250250

251-
static inline long __static_call_return0(void)
252-
{
253-
return 0;
254-
}
251+
extern long __static_call_return0(void);
255252

256253
#define EXPORT_STATIC_CALL(name) \
257254
EXPORT_SYMBOL(STATIC_CALL_KEY(name)); \

kernel/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ obj-$(CONFIG_CPU_PM) += cpu_pm.o
114114
obj-$(CONFIG_BPF) += bpf/
115115
obj-$(CONFIG_KCSAN) += kcsan/
116116
obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o
117-
obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call.o
117+
obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o
118+
obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o
118119
obj-$(CONFIG_CFI_CLANG) += cfi.o
119120

120121
obj-$(CONFIG_PERF_EVENTS) += events/

0 commit comments

Comments
 (0)