* [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4)
@ 2011-04-12 6:45 Tixy
2011-04-12 6:45 ` [PATCH 1/6] ARM: kprobes: Reject probing of LDRB instructions which load PC Tixy
` (6 more replies)
0 siblings, 7 replies; 11+ messages in thread
From: Tixy @ 2011-04-12 6:45 UTC (permalink / raw)
To: linux-arm-kernel
(This is a fourth set of patches)
When kprobes are inserted into code an ARM instruction is replaced
by a breakpoint. When this is hit, the original instruction must be
emulated out-of-line. This patchset fixes even more bugs in the
instruction decoding and emulation.
[PATCH 1/6] ARM: kprobes: Reject probing of LDRB instructions which load PC
[PATCH 2/6] ARM: kprobes: Add emulation of RBIT instruction
[PATCH 3/6] ARM: kprobes: Reject probing of undefined media instructions
[PATCH 4/6] ARM: kprobes: Fix emulation of SXTB16, SXTB, SXTH, UXTB16, UXTB and UXTH instructions
[PATCH 5/6] ARM: kprobes: Fix emulation of SMUAD, SMUSD and SMMUL instructions
[PATCH 6/6] ARM: kprobes: Fix emulation of USAD8 instructions
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/6] ARM: kprobes: Reject probing of LDRB instructions which load PC
2011-04-12 6:45 [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4) Tixy
@ 2011-04-12 6:45 ` Tixy
2011-04-12 6:45 ` [PATCH 2/6] ARM: kprobes: Add emulation of RBIT instruction Tixy
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Tixy @ 2011-04-12 6:45 UTC (permalink / raw)
To: linux-arm-kernel
From: Jon Medhurst <tixy@yxit.co.uk>
These instructions are specified as UNPREDICTABLE.
Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
---
arch/arm/kernel/kprobes-decode.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index bb239f6..7cb939a 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -1416,6 +1416,10 @@ space_cccc_01xx(kprobe_opcode_t insn, struct arch_specific_insn *asi)
/* STRB : cccc 01xx x1x0 xxxx xxxx xxxx xxxx xxxx */
/* STRBT : cccc 01x0 x110 xxxx xxxx xxxx xxxx xxxx */
/* STRT : cccc 01x0 x010 xxxx xxxx xxxx xxxx xxxx */
+
+ if ((insn & 0x00500000) == 0x00500000 && is_r15(insn, 12))
+ return INSN_REJECTED; /* LDRB into PC */
+
return prep_emulate_ldr_str(insn, asi);
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/6] ARM: kprobes: Add emulation of RBIT instruction
2011-04-12 6:45 [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4) Tixy
2011-04-12 6:45 ` [PATCH 1/6] ARM: kprobes: Reject probing of LDRB instructions which load PC Tixy
@ 2011-04-12 6:45 ` Tixy
2011-04-12 6:45 ` [PATCH 3/6] ARM: kprobes: Reject probing of undefined media instructions Tixy
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Tixy @ 2011-04-12 6:45 UTC (permalink / raw)
To: linux-arm-kernel
From: Jon Medhurst <tixy@yxit.co.uk>
The v6T2 RBIT instruction was accidentally being emulated correctly,
this patch adds correct decoding for the instruction.
Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
---
arch/arm/kernel/kprobes-decode.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index 7cb939a..f6367bf 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -1320,9 +1320,10 @@ space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
/* REV : cccc 0110 1011 xxxx xxxx xxxx 0011 xxxx */
/* REV16 : cccc 0110 1011 xxxx xxxx xxxx 1011 xxxx */
+ /* RBIT : cccc 0110 1111 xxxx xxxx xxxx 0011 xxxx */
/* REVSH : cccc 0110 1111 xxxx xxxx xxxx 1011 xxxx */
if ((insn & 0x0ff00070) == 0x06b00030 ||
- (insn & 0x0ff000f0) == 0x06f000b0)
+ (insn & 0x0ff00070) == 0x06f00030)
return prep_emulate_rd12rm0(insn, asi);
/* SADD16 : cccc 0110 0001 xxxx xxxx xxxx 0001 xxxx :GE */
--
1.7.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/6] ARM: kprobes: Reject probing of undefined media instructions
2011-04-12 6:45 [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4) Tixy
2011-04-12 6:45 ` [PATCH 1/6] ARM: kprobes: Reject probing of LDRB instructions which load PC Tixy
2011-04-12 6:45 ` [PATCH 2/6] ARM: kprobes: Add emulation of RBIT instruction Tixy
@ 2011-04-12 6:45 ` Tixy
2011-04-12 6:45 ` [PATCH 4/6] ARM: kprobes: Fix emulation of SXTB16, SXTB, SXTH, UXTB16, UXTB and UXTH instructions Tixy
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Tixy @ 2011-04-12 6:45 UTC (permalink / raw)
To: linux-arm-kernel
From: Jon Medhurst <tixy@yxit.co.uk>
The instructions space for media instructions contains some undefined
patterns. We need to reject probing of these because they may in future
become defined and the kprobes code may then emulate them faultily.
Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
---
arch/arm/kernel/kprobes-decode.c | 36 +++++++++++++++++++++++++++++++++++-
1 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index f6367bf..a824a79 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -1326,52 +1326,86 @@ space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
(insn & 0x0ff00070) == 0x06f00030)
return prep_emulate_rd12rm0(insn, asi);
+ /* ??? : cccc 0110 0000 xxxx xxxx xxxx xxx1 xxxx : */
/* SADD16 : cccc 0110 0001 xxxx xxxx xxxx 0001 xxxx :GE */
/* SADDSUBX : cccc 0110 0001 xxxx xxxx xxxx 0011 xxxx :GE */
/* SSUBADDX : cccc 0110 0001 xxxx xxxx xxxx 0101 xxxx :GE */
/* SSUB16 : cccc 0110 0001 xxxx xxxx xxxx 0111 xxxx :GE */
/* SADD8 : cccc 0110 0001 xxxx xxxx xxxx 1001 xxxx :GE */
+ /* ??? : cccc 0110 0001 xxxx xxxx xxxx 1011 xxxx : */
+ /* ??? : cccc 0110 0001 xxxx xxxx xxxx 1101 xxxx : */
/* SSUB8 : cccc 0110 0001 xxxx xxxx xxxx 1111 xxxx :GE */
/* QADD16 : cccc 0110 0010 xxxx xxxx xxxx 0001 xxxx : */
/* QADDSUBX : cccc 0110 0010 xxxx xxxx xxxx 0011 xxxx : */
/* QSUBADDX : cccc 0110 0010 xxxx xxxx xxxx 0101 xxxx : */
/* QSUB16 : cccc 0110 0010 xxxx xxxx xxxx 0111 xxxx : */
/* QADD8 : cccc 0110 0010 xxxx xxxx xxxx 1001 xxxx : */
+ /* ??? : cccc 0110 0010 xxxx xxxx xxxx 1011 xxxx : */
+ /* ??? : cccc 0110 0010 xxxx xxxx xxxx 1101 xxxx : */
/* QSUB8 : cccc 0110 0010 xxxx xxxx xxxx 1111 xxxx : */
/* SHADD16 : cccc 0110 0011 xxxx xxxx xxxx 0001 xxxx : */
/* SHADDSUBX : cccc 0110 0011 xxxx xxxx xxxx 0011 xxxx : */
/* SHSUBADDX : cccc 0110 0011 xxxx xxxx xxxx 0101 xxxx : */
/* SHSUB16 : cccc 0110 0011 xxxx xxxx xxxx 0111 xxxx : */
/* SHADD8 : cccc 0110 0011 xxxx xxxx xxxx 1001 xxxx : */
+ /* ??? : cccc 0110 0011 xxxx xxxx xxxx 1011 xxxx : */
+ /* ??? : cccc 0110 0011 xxxx xxxx xxxx 1101 xxxx : */
/* SHSUB8 : cccc 0110 0011 xxxx xxxx xxxx 1111 xxxx : */
+ /* ??? : cccc 0110 0100 xxxx xxxx xxxx xxx1 xxxx : */
/* UADD16 : cccc 0110 0101 xxxx xxxx xxxx 0001 xxxx :GE */
/* UADDSUBX : cccc 0110 0101 xxxx xxxx xxxx 0011 xxxx :GE */
/* USUBADDX : cccc 0110 0101 xxxx xxxx xxxx 0101 xxxx :GE */
/* USUB16 : cccc 0110 0101 xxxx xxxx xxxx 0111 xxxx :GE */
/* UADD8 : cccc 0110 0101 xxxx xxxx xxxx 1001 xxxx :GE */
+ /* ??? : cccc 0110 0101 xxxx xxxx xxxx 1011 xxxx : */
+ /* ??? : cccc 0110 0101 xxxx xxxx xxxx 1101 xxxx : */
/* USUB8 : cccc 0110 0101 xxxx xxxx xxxx 1111 xxxx :GE */
/* UQADD16 : cccc 0110 0110 xxxx xxxx xxxx 0001 xxxx : */
/* UQADDSUBX : cccc 0110 0110 xxxx xxxx xxxx 0011 xxxx : */
/* UQSUBADDX : cccc 0110 0110 xxxx xxxx xxxx 0101 xxxx : */
/* UQSUB16 : cccc 0110 0110 xxxx xxxx xxxx 0111 xxxx : */
/* UQADD8 : cccc 0110 0110 xxxx xxxx xxxx 1001 xxxx : */
+ /* ??? : cccc 0110 0110 xxxx xxxx xxxx 1011 xxxx : */
+ /* ??? : cccc 0110 0110 xxxx xxxx xxxx 1101 xxxx : */
/* UQSUB8 : cccc 0110 0110 xxxx xxxx xxxx 1111 xxxx : */
/* UHADD16 : cccc 0110 0111 xxxx xxxx xxxx 0001 xxxx : */
/* UHADDSUBX : cccc 0110 0111 xxxx xxxx xxxx 0011 xxxx : */
/* UHSUBADDX : cccc 0110 0111 xxxx xxxx xxxx 0101 xxxx : */
/* UHSUB16 : cccc 0110 0111 xxxx xxxx xxxx 0111 xxxx : */
/* UHADD8 : cccc 0110 0111 xxxx xxxx xxxx 1001 xxxx : */
+ /* ??? : cccc 0110 0111 xxxx xxxx xxxx 1011 xxxx : */
+ /* ??? : cccc 0110 0111 xxxx xxxx xxxx 1101 xxxx : */
/* UHSUB8 : cccc 0110 0111 xxxx xxxx xxxx 1111 xxxx : */
+ if ((insn & 0x0f800010) == 0x06000010) {
+ if ((insn & 0x00300000) == 0x00000000 ||
+ (insn & 0x000000e0) == 0x000000a0 ||
+ (insn & 0x000000e0) == 0x000000c0)
+ return INSN_REJECTED; /* Unallocated space */
+ return prep_emulate_rd12rn16rm0_wflags(insn, asi);
+ }
+
/* PKHBT : cccc 0110 1000 xxxx xxxx xxxx x001 xxxx : */
/* PKHTB : cccc 0110 1000 xxxx xxxx xxxx x101 xxxx : */
+ if ((insn & 0x0ff00030) == 0x06800010)
+ return prep_emulate_rd12rn16rm0_wflags(insn, asi);
+
/* SXTAB16 : cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx : */
/* SXTB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
+ /* ??? : cccc 0110 1001 xxxx xxxx xxxx 0111 xxxx : */
/* SXTAB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
/* SXTAH : cccc 0110 1011 xxxx xxxx xxxx 0111 xxxx : */
/* UXTAB16 : cccc 0110 1100 xxxx xxxx xxxx 0111 xxxx : */
+ /* ??? : cccc 0110 1101 xxxx xxxx xxxx 0111 xxxx : */
/* UXTAB : cccc 0110 1110 xxxx xxxx xxxx 0111 xxxx : */
/* UXTAH : cccc 0110 1111 xxxx xxxx xxxx 0111 xxxx : */
- return prep_emulate_rd12rn16rm0_wflags(insn, asi);
+ if ((insn & 0x0f8000f0) == 0x06800070) {
+ if ((insn & 0x00300000) == 0x00100000)
+ return INSN_REJECTED; /* Unallocated space */
+ return prep_emulate_rd12rn16rm0_wflags(insn, asi);
+ }
+
+ /* Other instruction encodings aren't yet defined */
+ return INSN_REJECTED;
}
static enum kprobe_insn __kprobes
--
1.7.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/6] ARM: kprobes: Fix emulation of SXTB16, SXTB, SXTH, UXTB16, UXTB and UXTH instructions
2011-04-12 6:45 [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4) Tixy
` (2 preceding siblings ...)
2011-04-12 6:45 ` [PATCH 3/6] ARM: kprobes: Reject probing of undefined media instructions Tixy
@ 2011-04-12 6:45 ` Tixy
2011-04-12 11:39 ` Sergei Shtylyov
2011-04-12 6:45 ` [PATCH 5/6] ARM: kprobes: Fix emulation of SMUAD, SMUSD and SMMUL instructions Tixy
` (2 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Tixy @ 2011-04-12 6:45 UTC (permalink / raw)
To: linux-arm-kernel
From: Jon Medhurst <tixy@yxit.co.uk>
These sign extension instructions are encoded as extend-and-add
instructions where the register to add is specified as r15. The decoding
routines weren't checking for this and were using the incorrect
emulation code, giving incorrect results.
Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
---
arch/arm/kernel/kprobes-decode.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index a824a79..30ba313 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -1390,18 +1390,28 @@ space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
return prep_emulate_rd12rn16rm0_wflags(insn, asi);
/* SXTAB16 : cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx : */
- /* SXTB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
+ /* SXTB16 : cccc 0110 1000 1111 xxxx xxxx 0111 xxxx : */
/* ??? : cccc 0110 1001 xxxx xxxx xxxx 0111 xxxx : */
/* SXTAB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
+ /* SXTB : cccc 0110 1010 1111 xxxx xxxx 0111 xxxx : */
/* SXTAH : cccc 0110 1011 xxxx xxxx xxxx 0111 xxxx : */
+ /* SXTH : cccc 0110 1011 1111 xxxx xxxx 0111 xxxx : */
/* UXTAB16 : cccc 0110 1100 xxxx xxxx xxxx 0111 xxxx : */
+ /* UXTB16 : cccc 0110 1100 1111 xxxx xxxx 0111 xxxx : */
/* ??? : cccc 0110 1101 xxxx xxxx xxxx 0111 xxxx : */
/* UXTAB : cccc 0110 1110 xxxx xxxx xxxx 0111 xxxx : */
+ /* UXTB : cccc 0110 1110 1111 xxxx xxxx 0111 xxxx : */
/* UXTAH : cccc 0110 1111 xxxx xxxx xxxx 0111 xxxx : */
+ /* UXTH : cccc 0110 1111 1111 xxxx xxxx 0111 xxxx : */
if ((insn & 0x0f8000f0) == 0x06800070) {
if ((insn & 0x00300000) == 0x00100000)
return INSN_REJECTED; /* Unallocated space */
- return prep_emulate_rd12rn16rm0_wflags(insn, asi);
+
+ if ((insn & 0x000f0000) == 0x000f0000) {
+ return prep_emulate_rd12rm0(insn, asi);
+ } else {
+ return prep_emulate_rd12rn16rm0_wflags(insn, asi);
+ }
}
/* Other instruction encodings aren't yet defined */
--
1.7.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/6] ARM: kprobes: Fix emulation of SMUAD, SMUSD and SMMUL instructions
2011-04-12 6:45 [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4) Tixy
` (3 preceding siblings ...)
2011-04-12 6:45 ` [PATCH 4/6] ARM: kprobes: Fix emulation of SXTB16, SXTB, SXTH, UXTB16, UXTB and UXTH instructions Tixy
@ 2011-04-12 6:45 ` Tixy
2011-04-12 11:42 ` Sergei Shtylyov
2011-04-12 6:45 ` [PATCH 6/6] ARM: kprobes: Fix emulation of USAD8 instructions Tixy
2011-04-12 19:09 ` [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4) Nicolas Pitre
6 siblings, 1 reply; 11+ messages in thread
From: Tixy @ 2011-04-12 6:45 UTC (permalink / raw)
To: linux-arm-kernel
From: Jon Medhurst <tixy@yxit.co.uk>
The signed multiply instructions were being decoded incorrectly.
Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
---
arch/arm/kernel/kprobes-decode.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index 30ba313..915b057 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -1436,18 +1436,26 @@ space_cccc_0111__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi);
/* SMLAD : cccc 0111 0000 xxxx xxxx xxxx 00x1 xxxx :Q */
+ /* SMUAD : cccc 0111 0000 xxxx 1111 xxxx 00x1 xxxx :Q */
/* SMLSD : cccc 0111 0000 xxxx xxxx xxxx 01x1 xxxx :Q */
+ /* SMUSD : cccc 0111 0000 xxxx 1111 xxxx 01x1 xxxx : */
/* SMMLA : cccc 0111 0101 xxxx xxxx xxxx 00x1 xxxx : */
- /* SMMLS : cccc 0111 0101 xxxx xxxx xxxx 11x1 xxxx : */
+ /* SMMUL : cccc 0111 0101 xxxx 1111 xxxx 00x1 xxxx : */
if ((insn & 0x0ff00090) == 0x07000010 ||
- (insn & 0x0ff000d0) == 0x07500010 ||
- (insn & 0x0ff000d0) == 0x075000d0)
+ (insn & 0x0ff000d0) == 0x07500010) {
+
+ if ((insn & 0x0000f000) == 0x0000f000) {
+ return prep_emulate_rd16rs8rm0_wflags(insn, asi);
+ } else {
+ return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
+ }
+ }
+
+ /* SMMLS : cccc 0111 0101 xxxx xxxx xxxx 11x1 xxxx : */
+ if ((insn & 0x0ff000d0) == 0x075000d0)
return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
- /* SMUSD : cccc 0111 0000 xxxx xxxx xxxx 01x1 xxxx : */
- /* SMUAD : cccc 0111 0000 xxxx 1111 xxxx 00x1 xxxx :Q */
- /* SMMUL : cccc 0111 0101 xxxx 1111 xxxx 00x1 xxxx : */
- return prep_emulate_rd16rs8rm0_wflags(insn, asi);
+ return INSN_REJECTED;
}
static enum kprobe_insn __kprobes
--
1.7.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 6/6] ARM: kprobes: Fix emulation of USAD8 instructions
2011-04-12 6:45 [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4) Tixy
` (4 preceding siblings ...)
2011-04-12 6:45 ` [PATCH 5/6] ARM: kprobes: Fix emulation of SMUAD, SMUSD and SMMUL instructions Tixy
@ 2011-04-12 6:45 ` Tixy
2011-04-12 19:09 ` [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4) Nicolas Pitre
6 siblings, 0 replies; 11+ messages in thread
From: Tixy @ 2011-04-12 6:45 UTC (permalink / raw)
To: linux-arm-kernel
From: Jon Medhurst <tixy@yxit.co.uk>
The USAD8 instruction wasn't being explicitly decoded leading
to the incorrect emulation routine being called. It can be correctly
decoded in the same way as the signed multiply instructions so we move
the decoding there.
Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
---
arch/arm/kernel/kprobes-decode.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index 915b057..43c2bf2 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -1425,11 +1425,6 @@ space_cccc_0111__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
if ((insn & 0x0ff000f0) == 0x03f000f0)
return INSN_REJECTED;
- /* USADA8 : cccc 0111 1000 xxxx xxxx xxxx 0001 xxxx */
- /* USAD8 : cccc 0111 1000 xxxx 1111 xxxx 0001 xxxx */
- if ((insn & 0x0ff000f0) == 0x07800010)
- return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
-
/* SMLALD : cccc 0111 0100 xxxx xxxx xxxx 00x1 xxxx */
/* SMLSLD : cccc 0111 0100 xxxx xxxx xxxx 01x1 xxxx */
if ((insn & 0x0ff00090) == 0x07400010)
@@ -1441,8 +1436,11 @@ space_cccc_0111__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
/* SMUSD : cccc 0111 0000 xxxx 1111 xxxx 01x1 xxxx : */
/* SMMLA : cccc 0111 0101 xxxx xxxx xxxx 00x1 xxxx : */
/* SMMUL : cccc 0111 0101 xxxx 1111 xxxx 00x1 xxxx : */
+ /* USADA8 : cccc 0111 1000 xxxx xxxx xxxx 0001 xxxx : */
+ /* USAD8 : cccc 0111 1000 xxxx 1111 xxxx 0001 xxxx : */
if ((insn & 0x0ff00090) == 0x07000010 ||
- (insn & 0x0ff000d0) == 0x07500010) {
+ (insn & 0x0ff000d0) == 0x07500010 ||
+ (insn & 0x0ff000f0) == 0x07800010) {
if ((insn & 0x0000f000) == 0x0000f000) {
return prep_emulate_rd16rs8rm0_wflags(insn, asi);
--
1.7.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/6] ARM: kprobes: Fix emulation of SXTB16, SXTB, SXTH, UXTB16, UXTB and UXTH instructions
2011-04-12 6:45 ` [PATCH 4/6] ARM: kprobes: Fix emulation of SXTB16, SXTB, SXTH, UXTB16, UXTB and UXTH instructions Tixy
@ 2011-04-12 11:39 ` Sergei Shtylyov
2011-04-12 15:16 ` Tixy
0 siblings, 1 reply; 11+ messages in thread
From: Sergei Shtylyov @ 2011-04-12 11:39 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
On 12-04-2011 10:45, Tixy wrote:
> From: Jon Medhurst <tixy@yxit.co.uk>
> These sign extension instructions are encoded as extend-and-add
> instructions where the register to add is specified as r15. The decoding
> routines weren't checking for this and were using the incorrect
> emulation code, giving incorrect results.
> Signed-off-by: Jon Medhurst<tixy@yxit.co.uk>
> ---
> arch/arm/kernel/kprobes-decode.c | 14 ++++++++++++--
> 1 files changed, 12 insertions(+), 2 deletions(-)
> diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
> index a824a79..30ba313 100644
> --- a/arch/arm/kernel/kprobes-decode.c
> +++ b/arch/arm/kernel/kprobes-decode.c
> @@ -1390,18 +1390,28 @@ space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
> return prep_emulate_rd12rn16rm0_wflags(insn, asi);
>
> /* SXTAB16 : cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx : */
> - /* SXTB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
> + /* SXTB16 : cccc 0110 1000 1111 xxxx xxxx 0111 xxxx : */
> /* ??? : cccc 0110 1001 xxxx xxxx xxxx 0111 xxxx : */
> /* SXTAB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
> + /* SXTB : cccc 0110 1010 1111 xxxx xxxx 0111 xxxx : */
> /* SXTAH : cccc 0110 1011 xxxx xxxx xxxx 0111 xxxx : */
> + /* SXTH : cccc 0110 1011 1111 xxxx xxxx 0111 xxxx : */
> /* UXTAB16 : cccc 0110 1100 xxxx xxxx xxxx 0111 xxxx : */
> + /* UXTB16 : cccc 0110 1100 1111 xxxx xxxx 0111 xxxx : */
> /* ??? : cccc 0110 1101 xxxx xxxx xxxx 0111 xxxx : */
> /* UXTAB : cccc 0110 1110 xxxx xxxx xxxx 0111 xxxx : */
> + /* UXTB : cccc 0110 1110 1111 xxxx xxxx 0111 xxxx : */
> /* UXTAH : cccc 0110 1111 xxxx xxxx xxxx 0111 xxxx : */
> + /* UXTH : cccc 0110 1111 1111 xxxx xxxx 0111 xxxx : */
> if ((insn & 0x0f8000f0) == 0x06800070) {
> if ((insn & 0x00300000) == 0x00100000)
> return INSN_REJECTED; /* Unallocated space */
> - return prep_emulate_rd12rn16rm0_wflags(insn, asi);
> +
> + if ((insn & 0x000f0000) == 0x000f0000) {
> + return prep_emulate_rd12rm0(insn, asi);
> + } else {
> + return prep_emulate_rd12rn16rm0_wflags(insn, asi);
> + }
Why use {} around single statements? checkpatch.pl used to warn about this...
WBR, Sergei
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 5/6] ARM: kprobes: Fix emulation of SMUAD, SMUSD and SMMUL instructions
2011-04-12 6:45 ` [PATCH 5/6] ARM: kprobes: Fix emulation of SMUAD, SMUSD and SMMUL instructions Tixy
@ 2011-04-12 11:42 ` Sergei Shtylyov
0 siblings, 0 replies; 11+ messages in thread
From: Sergei Shtylyov @ 2011-04-12 11:42 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
On 12-04-2011 10:45, Tixy wrote:
> From: Jon Medhurst<tixy@yxit.co.uk>
> The signed multiply instructions were being decoded incorrectly.
> Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
> ---
> arch/arm/kernel/kprobes-decode.c | 22 +++++++++++++++-------
> 1 files changed, 15 insertions(+), 7 deletions(-)
> diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
> index 30ba313..915b057 100644
> --- a/arch/arm/kernel/kprobes-decode.c
> +++ b/arch/arm/kernel/kprobes-decode.c
> @@ -1436,18 +1436,26 @@ space_cccc_0111__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
> return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi);
>
> /* SMLAD : cccc 0111 0000 xxxx xxxx xxxx 00x1 xxxx :Q */
> + /* SMUAD : cccc 0111 0000 xxxx 1111 xxxx 00x1 xxxx :Q */
> /* SMLSD : cccc 0111 0000 xxxx xxxx xxxx 01x1 xxxx :Q */
> + /* SMUSD : cccc 0111 0000 xxxx 1111 xxxx 01x1 xxxx : */
> /* SMMLA : cccc 0111 0101 xxxx xxxx xxxx 00x1 xxxx : */
> - /* SMMLS : cccc 0111 0101 xxxx xxxx xxxx 11x1 xxxx : */
> + /* SMMUL : cccc 0111 0101 xxxx 1111 xxxx 00x1 xxxx : */
> if ((insn& 0x0ff00090) == 0x07000010 ||
> - (insn& 0x0ff000d0) == 0x07500010 ||
> - (insn& 0x0ff000d0) == 0x075000d0)
> + (insn& 0x0ff000d0) == 0x07500010) {
> +
> + if ((insn& 0x0000f000) == 0x0000f000) {
> + return prep_emulate_rd16rs8rm0_wflags(insn, asi);
> + } else {
> + return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
> + }
Why use {} around the single statements here?
> + }
> +
> + /* SMMLS : cccc 0111 0101 xxxx xxxx xxxx 11x1 xxxx : */
> + if ((insn & 0x0ff000d0) == 0x075000d0)
> return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
... but not here. It's at least inconsistent. :-)
WBR, Sergei
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 4/6] ARM: kprobes: Fix emulation of SXTB16, SXTB, SXTH, UXTB16, UXTB and UXTH instructions
2011-04-12 11:39 ` Sergei Shtylyov
@ 2011-04-12 15:16 ` Tixy
0 siblings, 0 replies; 11+ messages in thread
From: Tixy @ 2011-04-12 15:16 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 2011-04-12 at 15:39 +0400, Sergei Shtylyov wrote:
> Why use {} around single statements? checkpatch.pl used to warn about this...
It still does ;-)
I'll fix them.
--
Tixy
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4)
2011-04-12 6:45 [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4) Tixy
` (5 preceding siblings ...)
2011-04-12 6:45 ` [PATCH 6/6] ARM: kprobes: Fix emulation of USAD8 instructions Tixy
@ 2011-04-12 19:09 ` Nicolas Pitre
6 siblings, 0 replies; 11+ messages in thread
From: Nicolas Pitre @ 2011-04-12 19:09 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 12 Apr 2011, Tixy wrote:
> (This is a fourth set of patches)
Looks good, merged in the usual branch.
Nicolas
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-04-12 19:09 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-12 6:45 [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4) Tixy
2011-04-12 6:45 ` [PATCH 1/6] ARM: kprobes: Reject probing of LDRB instructions which load PC Tixy
2011-04-12 6:45 ` [PATCH 2/6] ARM: kprobes: Add emulation of RBIT instruction Tixy
2011-04-12 6:45 ` [PATCH 3/6] ARM: kprobes: Reject probing of undefined media instructions Tixy
2011-04-12 6:45 ` [PATCH 4/6] ARM: kprobes: Fix emulation of SXTB16, SXTB, SXTH, UXTB16, UXTB and UXTH instructions Tixy
2011-04-12 11:39 ` Sergei Shtylyov
2011-04-12 15:16 ` Tixy
2011-04-12 6:45 ` [PATCH 5/6] ARM: kprobes: Fix emulation of SMUAD, SMUSD and SMMUL instructions Tixy
2011-04-12 11:42 ` Sergei Shtylyov
2011-04-12 6:45 ` [PATCH 6/6] ARM: kprobes: Fix emulation of USAD8 instructions Tixy
2011-04-12 19:09 ` [PATCH 0/6] ARM: kprobes: Fixes for ARM instruction emulation (part 4) Nicolas Pitre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).