Skip to content

Commit d2f7eca

Browse files
frestrRussell King
authored andcommitted
ARM: 9071/1: uprobes: Don't hook on thumb instructions
Since uprobes is not supported for thumb, check that the thumb bit is not set when matching the uprobes instruction hooks. The Arm UDF instructions used for uprobes triggering (UPROBE_SWBP_ARM_INSN and UPROBE_SS_ARM_INSN) coincidentally share the same encoding as a pair of unallocated 32-bit thumb instructions (not UDF) when the condition code is 0b1111 (0xf). This in effect makes it possible to trigger the uprobes functionality from thumb, and at that using two unallocated instructions which are not permanently undefined. Signed-off-by: Fredrik Strupe <[email protected]> Cc: [email protected] Fixes: c7edc9e ("ARM: add uprobes support") Signed-off-by: Russell King <[email protected]>
1 parent 30e3b4f commit d2f7eca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm/probes/uprobes/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,15 @@ unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
204204
static struct undef_hook uprobes_arm_break_hook = {
205205
.instr_mask = 0x0fffffff,
206206
.instr_val = (UPROBE_SWBP_ARM_INSN & 0x0fffffff),
207-
.cpsr_mask = MODE_MASK,
207+
.cpsr_mask = (PSR_T_BIT | MODE_MASK),
208208
.cpsr_val = USR_MODE,
209209
.fn = uprobe_trap_handler,
210210
};
211211

212212
static struct undef_hook uprobes_arm_ss_hook = {
213213
.instr_mask = 0x0fffffff,
214214
.instr_val = (UPROBE_SS_ARM_INSN & 0x0fffffff),
215-
.cpsr_mask = MODE_MASK,
215+
.cpsr_mask = (PSR_T_BIT | MODE_MASK),
216216
.cpsr_val = USR_MODE,
217217
.fn = uprobe_trap_handler,
218218
};

0 commit comments

Comments
 (0)