diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2021-02-11 09:36:36 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2021-02-11 15:28:34 +0300 |
commit | e4bb64c7a42e61bcb6f8b70279fc1f7805eaad3f (patch) | |
tree | 2ec0a90c74c84dd91ff42350a5a3070f7aa62ace /arch/powerpc/include | |
parent | dea6f4c696996b9dff37f4e6690eb30e0878ace9 (diff) | |
download | linux-e4bb64c7a42e61bcb6f8b70279fc1f7805eaad3f.tar.xz |
powerpc: remove interrupt handler functions from the noinstr section
The allyesconfig ppc64 kernel fails to link with relocations unable to
fit after commit 3a96570ffceb ("powerpc: convert interrupt handlers to
use wrappers"), which is due to the interrupt handler functions being
put into the .noinstr.text section, which the linker script places on
the opposite side of the main .text section from the interrupt entry
asm code which calls the handlers.
This results in a lot of linker stubs that overwhelm the 252-byte sized
space we allow for them, or in the case of BE a .opd relocation link
error for some reason.
It's not required to put interrupt handlers in the .noinstr section,
previously they used NOKPROBE_SYMBOL, so take them out and replace
with a NOKPROBE_SYMBOL in the wrapper macro. Remove the explicit
NOKPROBE_SYMBOL macros in the interrupt handler functions. This makes
a number of interrupt handlers nokprobe that were not prior to the
interrupt wrappers commit, but since that commit they were made
nokprobe due to being in .noinstr.text, so this fix does not change
that.
The fixes tag is different to the commit that first exposes the problem
because it is where the wrapper macros were introduced.
Fixes: 8d41fc618ab8 ("powerpc: interrupt handler wrapper functions")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Slightly fix up comment wording]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210211063636.236420-1-npiggin@gmail.com
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r-- | arch/powerpc/include/asm/interrupt.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h index 4badb3e51c19..5c285592d9b6 100644 --- a/arch/powerpc/include/asm/interrupt.h +++ b/arch/powerpc/include/asm/interrupt.h @@ -6,6 +6,7 @@ #include <linux/hardirq.h> #include <asm/cputime.h> #include <asm/ftrace.h> +#include <asm/kprobes.h> #include <asm/runlatch.h> struct interrupt_state { @@ -164,6 +165,15 @@ static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct inter #endif } +/* + * Don't use noinstr here like x86, but rather add NOKPROBE_SYMBOL to each + * function definition. The reason for this is the noinstr section is placed + * after the main text section, i.e., very far away from the interrupt entry + * asm. That creates problems with fitting linker stubs when building large + * kernels. + */ +#define interrupt_handler __visible noinline notrace __no_kcsan __no_sanitize_address + /** * DECLARE_INTERRUPT_HANDLER_RAW - Declare raw interrupt handler function * @func: Function name of the entry point @@ -198,7 +208,7 @@ static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct inter #define DEFINE_INTERRUPT_HANDLER_RAW(func) \ static __always_inline long ____##func(struct pt_regs *regs); \ \ -__visible noinstr long func(struct pt_regs *regs) \ +interrupt_handler long func(struct pt_regs *regs) \ { \ long ret; \ \ @@ -206,6 +216,7 @@ __visible noinstr long func(struct pt_regs *regs) \ \ return ret; \ } \ +NOKPROBE_SYMBOL(func); \ \ static __always_inline long ____##func(struct pt_regs *regs) @@ -228,7 +239,7 @@ static __always_inline long ____##func(struct pt_regs *regs) #define DEFINE_INTERRUPT_HANDLER(func) \ static __always_inline void ____##func(struct pt_regs *regs); \ \ -__visible noinstr void func(struct pt_regs *regs) \ +interrupt_handler void func(struct pt_regs *regs) \ { \ struct interrupt_state state; \ \ @@ -238,6 +249,7 @@ __visible noinstr void func(struct pt_regs *regs) \ \ interrupt_exit_prepare(regs, &state); \ } \ +NOKPROBE_SYMBOL(func); \ \ static __always_inline void ____##func(struct pt_regs *regs) @@ -262,7 +274,7 @@ static __always_inline void ____##func(struct pt_regs *regs) #define DEFINE_INTERRUPT_HANDLER_RET(func) \ static __always_inline long ____##func(struct pt_regs *regs); \ \ -__visible noinstr long func(struct pt_regs *regs) \ +interrupt_handler long func(struct pt_regs *regs) \ { \ struct interrupt_state state; \ long ret; \ @@ -275,6 +287,7 @@ __visible noinstr long func(struct pt_regs *regs) \ \ return ret; \ } \ +NOKPROBE_SYMBOL(func); \ \ static __always_inline long ____##func(struct pt_regs *regs) @@ -297,7 +310,7 @@ static __always_inline long ____##func(struct pt_regs *regs) #define DEFINE_INTERRUPT_HANDLER_ASYNC(func) \ static __always_inline void ____##func(struct pt_regs *regs); \ \ -__visible noinstr void func(struct pt_regs *regs) \ +interrupt_handler void func(struct pt_regs *regs) \ { \ struct interrupt_state state; \ \ @@ -307,6 +320,7 @@ __visible noinstr void func(struct pt_regs *regs) \ \ interrupt_async_exit_prepare(regs, &state); \ } \ +NOKPROBE_SYMBOL(func); \ \ static __always_inline void ____##func(struct pt_regs *regs) @@ -331,7 +345,7 @@ static __always_inline void ____##func(struct pt_regs *regs) #define DEFINE_INTERRUPT_HANDLER_NMI(func) \ static __always_inline long ____##func(struct pt_regs *regs); \ \ -__visible noinstr long func(struct pt_regs *regs) \ +interrupt_handler long func(struct pt_regs *regs) \ { \ struct interrupt_nmi_state state; \ long ret; \ @@ -344,6 +358,7 @@ __visible noinstr long func(struct pt_regs *regs) \ \ return ret; \ } \ +NOKPROBE_SYMBOL(func); \ \ static __always_inline long ____##func(struct pt_regs *regs) |