提交 6823fc85 编写于 作者: J Jon Medhurst 提交者: Nicolas Pitre

ARM: kprobes: Fix emulation of LDRH, STRH, LDRSB and LDRSH instructions

The decoding of these instructions got the register indexed and
immediate indexed forms the wrong way around, causing incorrect
emulation.
Signed-off-by: NJon Medhurst <tixy@yxit.co.uk>
Signed-off-by: NNicolas Pitre <nicolas.pitre@linaro.org>
上级 ec58d7f2
...@@ -883,11 +883,12 @@ emulate_alu_tests(struct kprobe *p, struct pt_regs *regs) ...@@ -883,11 +883,12 @@ emulate_alu_tests(struct kprobe *p, struct pt_regs *regs)
static enum kprobe_insn __kprobes static enum kprobe_insn __kprobes
prep_emulate_ldr_str(kprobe_opcode_t insn, struct arch_specific_insn *asi) prep_emulate_ldr_str(kprobe_opcode_t insn, struct arch_specific_insn *asi)
{ {
int ibit = (insn & (1 << 26)) ? 25 : 22; int not_imm = (insn & (1 << 26)) ? (insn & (1 << 25))
: (~insn & (1 << 22));
insn &= 0xfff00fff; insn &= 0xfff00fff;
insn |= 0x00001000; /* Rn = r0, Rd = r1 */ insn |= 0x00001000; /* Rn = r0, Rd = r1 */
if (insn & (1 << ibit)) { if (not_imm) {
insn &= ~0xf; insn &= ~0xf;
insn |= 2; /* Rm = r2 */ insn |= 2; /* Rm = r2 */
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册