FAILED: patch "[PATCH] static_call: Don't make __static_call_return0 static" failed to apply to 5.16-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.16-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 8fd4ddda2f49a66bf5dd3d0c01966c4b1971308b Mon Sep 17 00:00:00 2001
From: Christophe Leroy <[email protected]>
Date: Mon, 14 Mar 2022 12:49:36 +0100
Subject: [PATCH] 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.
include/linux/static_call.h +1 -4
@@ -248,10 +248,7 @@ static inline int static_call_text_reserved(void *start, void *end)return 0 ; } -static inline long __static_call_return0 (void ) -{ -return 0 ; -} +extern long __static_call_return0 (void );#define EXPORT_STATIC_CALL (name) \ EXPORT_SYMBOL(STATIC_CALL_KEY(name)); \
kernel/Makefile +2 -1
@@ -114,7 +114,8 @@ obj-$(CONFIG_CPU_PM) += cpu_pm.o obj-$(CONFIG_BPF) += bpf/ obj-$(CONFIG_KCSAN) += kcsan/ obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o -obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call.o +obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o +obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o obj-$(CONFIG_CFI_CLANG) += cfi.o obj-$(CONFIG_PERF_EVENTS) += events/
kernel/static_call.c +0 -541
549 lines not on this page · raw message
kernel/static_call_inline.c new file +543 -0
543 lines not on this page · raw message