diff options
| author | Jiaxun Yang <jiaxun.yang@flygoat.com> | 2024-02-02 12:30:26 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-07 16:56:51 +0100 |
| commit | 7b425f542f95b37dbf1c0fecd7825c7865befdff (patch) | |
| tree | f0ec20c33349136d23c95815a574abb9f0fedfad /arch | |
| parent | ef3bc90758c5d2f2c13ef21c5c11616d365a5fd6 (diff) | |
| download | linux-7b425f542f95b37dbf1c0fecd7825c7865befdff.tar.gz linux-7b425f542f95b37dbf1c0fecd7825c7865befdff.tar.bz2 linux-7b425f542f95b37dbf1c0fecd7825c7865befdff.zip | |
ptrace: Introduce exception_ip arch hook
commit 11ba1728be3edb6928791f4c622f154ebe228ae6 upstream.
On architectures with delay slot, architecture level instruction
pointer (or program counter) in pt_regs may differ from where
exception was triggered.
Introduce exception_ip hook to invoke architecture code and determine
actual instruction pointer to the exception.
Link: https://lore.kernel.org/lkml/00d1b813-c55f-4365-8d81-d70258e10b16@app.fastmail.com/
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Salvatore Bonaccorso <carnil@debian.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/mips/include/asm/ptrace.h | 2 | ||||
| -rw-r--r-- | arch/mips/kernel/ptrace.c | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h index 428b9f1cf1de..4a2b40ce39e0 100644 --- a/arch/mips/include/asm/ptrace.h +++ b/arch/mips/include/asm/ptrace.h @@ -155,6 +155,8 @@ static inline long regs_return_value(struct pt_regs *regs) } #define instruction_pointer(regs) ((regs)->cp0_epc) +extern unsigned long exception_ip(struct pt_regs *regs); +#define exception_ip(regs) exception_ip(regs) #define profile_pc(regs) instruction_pointer(regs) extern asmlinkage long syscall_trace_enter(struct pt_regs *regs); diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index a8e569830ec8..fdcaad9fba1d 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -31,6 +31,7 @@ #include <linux/seccomp.h> #include <linux/ftrace.h> +#include <asm/branch.h> #include <asm/byteorder.h> #include <asm/cpu.h> #include <asm/cpu-info.h> @@ -48,6 +49,12 @@ #define CREATE_TRACE_POINTS #include <trace/events/syscalls.h> +unsigned long exception_ip(struct pt_regs *regs) +{ + return exception_epc(regs); +} +EXPORT_SYMBOL(exception_ip); + /* * Called by kernel/ptrace.c when detaching.. * |
