Skip to content

Commit

Permalink
s390/kprobes: fix instruction copy for out of line execution
Browse files Browse the repository at this point in the history
When we generate the instruction for out of line execution the length
of the to be copied instruction was evaluated from a not initialized
memory location.
Therefore we ended up with a random (2, 4 or 6) number of bytes being
copied instead of taking the real instruction length into account.
This works surprisingly well most of the time, but still not always.

Reported-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed Dec 1, 2014
1 parent 57f2ffe commit ed7d56e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/s390/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void copy_instruction(struct kprobe *p)
ftrace_generate_nop_insn((struct ftrace_insn *)p->ainsn.insn);
p->ainsn.is_ftrace_insn = 1;
} else
memcpy(p->ainsn.insn, p->addr, insn_length(p->opcode >> 8));
memcpy(p->ainsn.insn, p->addr, insn_length(*p->addr >> 8));
p->opcode = p->ainsn.insn[0];
if (!probe_is_insn_relative_long(p->ainsn.insn))
return;
Expand Down

0 comments on commit ed7d56e

Please sign in to comment.