ptrace: Introduce exception_ip arch hook
[ Upstream commit 11ba1728be3edb6928791f4c622f154ebe228ae6 ] 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> Stable-dep-of: 8fa507083388 ("mm/memory: Use exception ip to search exception tables") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2252913f15
commit
fdd12a80f6
|
@ -154,6 +154,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, long syscall);
|
||||
|
|
|
@ -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..
|
||||
*
|
||||
|
|
|
@ -393,6 +393,10 @@ static inline void user_single_step_report(struct pt_regs *regs)
|
|||
#define current_user_stack_pointer() user_stack_pointer(current_pt_regs())
|
||||
#endif
|
||||
|
||||
#ifndef exception_ip
|
||||
#define exception_ip(x) instruction_pointer(x)
|
||||
#endif
|
||||
|
||||
extern int task_current_syscall(struct task_struct *target, struct syscall_info *info);
|
||||
|
||||
extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact);
|
||||
|
|
Loading…
Reference in New Issue