diff options
author | Igor Nabirushkin <inabirushkin@nvidia.com> | 2013-02-01 03:05:24 +0400 |
---|---|---|
committer | Riham Haidar <rhaidar@nvidia.com> | 2013-07-10 18:18:41 -0700 |
commit | 63ad94aa0f159198c04a7c7b8ca48f46bb4dd03f (patch) | |
tree | 87bd99a9af1f4a70563b5638898d0fed15e11e99 /arch | |
parent | b8080933eabc8826d59f90de53dcb4f681173155 (diff) |
ARM: kprobes: Fix kprobes build
Fix incorrect changes in the arch_arm_kprobe
function (commit: 3b3f4d24917c97fa75aa4fba2b09797ef94cea38)
Bug 1228659
Change-Id: Iee16e3d5f6475acd9cd08060b16d015e8757a286
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/208435
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Andrey Trachenko <atrachenko@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dan Willemsen <dwillemsen@nvidia.com>
Tested-by: Andrey Trachenko <atrachenko@nvidia.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/kernel/kprobes.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c index 2d0dba850bb1..4dd41fc9e235 100644 --- a/arch/arm/kernel/kprobes.c +++ b/arch/arm/kernel/kprobes.c @@ -106,14 +106,17 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) void __kprobes arch_arm_kprobe(struct kprobe *p) { - uintptr_t addr = (uintptr_t)p->addr & ~1; /* Remove any Thumb flag */ - - if (!is_wide_instruction(p->opcode)) { - *(u16 *)addr = KPROBE_THUMB16_BREAKPOINT_INSTRUCTION; - flush_insns(addr, sizeof(u16)); - } else if (addr & 2) { - /* A 32-bit instruction spanning two words needs special care */ - stop_machine(set_t32_breakpoint, (void *)addr, cpu_online_mask); + unsigned int brkp; + void *addr; + + if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { + /* Remove any Thumb flag */ + addr = (void *)((uintptr_t)p->addr & ~1); + + if (is_wide_instruction(p->opcode)) + brkp = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION; + else + brkp = KPROBE_THUMB16_BREAKPOINT_INSTRUCTION; } else { kprobe_opcode_t insn = p->opcode; |