* [patch] s390 kprobe fix instruction length calculation
@ 2007-08-15 21:31 David Wilder
2007-08-15 22:41 ` Heiko Carstens
0 siblings, 1 reply; 2+ messages in thread
From: David Wilder @ 2007-08-15 21:31 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: martin.schwidefsky
[-- Attachment #1: Type: text/plain, Size: 598 bytes --]
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.
[-- Attachment #2: s390_kprobes_ilen.patch --]
[-- Type: text/x-patch, Size: 566 bytes --]
arch/s390/kernel/kprobes.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 358d2bb..e40373d 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -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;
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [patch] s390 kprobe fix instruction length calculation
2007-08-15 21:31 [patch] s390 kprobe fix instruction length calculation David Wilder
@ 2007-08-15 22:41 ` Heiko Carstens
0 siblings, 0 replies; 2+ messages in thread
From: Heiko Carstens @ 2007-08-15 22:41 UTC (permalink / raw)
To: David Wilder; +Cc: Linux Kernel Mailing List, martin.schwidefsky
On Wed, Aug 15, 2007 at 02:31:40PM -0700, David Wilder wrote:
> 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.
>
> /* 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! :)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-15 22:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-15 21:31 [patch] s390 kprobe fix instruction length calculation David Wilder
2007-08-15 22:41 ` Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox