mirror of
https://github.com/torvalds/linux
synced 2024-10-15 15:59:15 +00:00
MIPS: uprobes: fix use of uninitialised variable
arch_uprobe_pre_xol needs to emulate a branch if a branch instruction
has been replaced with a breakpoint, but in fact an uninitialised local
variable was passed to the emulator routine instead of the original
instruction
Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Fixes: 40e084a506
('MIPS: Add uprobes support.')
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14300/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
ddabfa5c2e
commit
ca86c9ef2b
|
@ -157,7 +157,6 @@ bool is_trap_insn(uprobe_opcode_t *insn)
|
||||||
int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs)
|
int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
struct uprobe_task *utask = current->utask;
|
struct uprobe_task *utask = current->utask;
|
||||||
union mips_instruction insn;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now find the EPC where to resume after the breakpoint has been
|
* Now find the EPC where to resume after the breakpoint has been
|
||||||
|
@ -168,10 +167,10 @@ int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs)
|
||||||
unsigned long epc;
|
unsigned long epc;
|
||||||
|
|
||||||
epc = regs->cp0_epc;
|
epc = regs->cp0_epc;
|
||||||
__compute_return_epc_for_insn(regs, insn);
|
__compute_return_epc_for_insn(regs,
|
||||||
|
(union mips_instruction) aup->insn[0]);
|
||||||
aup->resume_epc = regs->cp0_epc;
|
aup->resume_epc = regs->cp0_epc;
|
||||||
}
|
}
|
||||||
|
|
||||||
utask->autask.saved_trap_nr = current->thread.trap_nr;
|
utask->autask.saved_trap_nr = current->thread.trap_nr;
|
||||||
current->thread.trap_nr = UPROBE_TRAP_NR;
|
current->thread.trap_nr = UPROBE_TRAP_NR;
|
||||||
regs->cp0_epc = current->utask->xol_vaddr;
|
regs->cp0_epc = current->utask->xol_vaddr;
|
||||||
|
|
Loading…
Reference in a new issue