s390 kprobe fix instruction length calculation
PATCH 1/1 s390 kprobe fix instruction length calculation
Placing a kprobe on "bc" instruction (s390/s390x) can cause an oops.
The instruction length is encoded into the first two bits of the s390 instruction. Kprobe is incorrectly computing the instruction length.
The instruction length is used for determining what type of "fix-up" is needed for conditional branch instruction. The problem can bee seen by placing a kprobe on a "bc" instruction that will not branch. The results is that Kprobe incorrectly computes the new instruction pointer (psw.addr) after single stepping the instruction. The problem is corrected with this patch.
arch/s390/kernel/kprobes.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/s390/kernel/kprobes.c +1 -1
@@ -85,7 +85,7 @@ void __kprobes get_instruction_type(struct arch_specific_insn *ainsn) ainsn->reg = (*ainsn->insn &0xf0 ) >>4 ;/* save the instruction length (pop 5-5) in bytes */ -switch (*(__u8 *) (ainsn->insn) >>4 ) { +switch (*(__u8 *) (ainsn->insn) >>6 ) {case 0 : ainsn->ilen =2 ;break ;
Quoted 10 lines · David Wilder
Placing a kprobe on "bc" instruction (s390/s390x) can cause an oops. The instruction length is encoded into the first two bits of the s390 instruction. Kprobe is incorrectly computing the instruction length. The instruction length is used for determining what type of "fix-up" is needed for conditional branch instruction. The problem can bee seen by
placing a kprobe on a "bc" instruction that will not branch. The results
is that Kprobe incorrectly computes the new instruction pointer
(psw.addr) after single stepping the instruction. The problem is
corrected with this patch.
arch/s390/kernel/kprobes.c void __kprobes get_instruction_type(struct arch_specific_insn *ainsn) · line 89
Quoted 4 lines
arch/s390/kernel/kprobes.c +1
-1/* save the instruction length (pop 5-5) in bytes */ -switch (*(__u8 *) (ainsn->insn) >>4 ) { +switch (*(__u8 *) (ainsn->insn) >>6 ) {case 0 :
Added to the s390 patch queue. Thanks! :)