mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
powerpc/kprobes: Use probe_address() to read instructions
In order to avoid Oopses, use probe_address() to read the instruction at the address where the trap happened. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/7f24b5961a6839ff01df792816807f74ff236bf6.1582567319.git.christophe.leroy@c-s.fr
This commit is contained in:
parent
08b1add150
commit
9ed5df69b7
1 changed files with 7 additions and 3 deletions
|
@ -287,14 +287,18 @@ int kprobe_handler(struct pt_regs *regs)
|
|||
|
||||
p = get_kprobe(addr);
|
||||
if (!p) {
|
||||
if (*addr != BREAKPOINT_INSTRUCTION) {
|
||||
unsigned int instr;
|
||||
|
||||
if (probe_kernel_address(addr, instr))
|
||||
goto no_kprobe;
|
||||
|
||||
if (instr != BREAKPOINT_INSTRUCTION) {
|
||||
/*
|
||||
* PowerPC has multiple variants of the "trap"
|
||||
* instruction. If the current instruction is a
|
||||
* trap variant, it could belong to someone else
|
||||
*/
|
||||
kprobe_opcode_t cur_insn = *addr;
|
||||
if (is_trap(cur_insn))
|
||||
if (is_trap(instr))
|
||||
goto no_kprobe;
|
||||
/*
|
||||
* The breakpoint instruction was removed right
|
||||
|
|
Loading…
Reference in a new issue