summaryrefslogtreecommitdiff
path: root/arch/arm64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/kernel/traps.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index ab9f1ec73933..d23f9341c58e 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -287,19 +287,23 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
/* check for AArch32 breakpoint instructions */
if (!aarch32_break_handler(regs))
return;
- if (compat_thumb_mode(regs)) {
- if (get_user(instr, (u16 __user *)pc))
- goto die_sig;
- if (is_wide_instruction(instr)) {
- u32 instr2;
- if (get_user(instr2, (u16 __user *)pc+1))
+ if (user_mode(regs)) {
+ if (compat_thumb_mode(regs)) {
+ if (get_user(instr, (u16 __user *)pc))
goto die_sig;
- instr <<= 16;
- instr |= instr2;
+ if (is_wide_instruction(instr)) {
+ u32 instr2;
+ if (get_user(instr2, (u16 __user *)pc+1))
+ goto die_sig;
+ instr <<= 16;
+ instr |= instr2;
+ }
+ } else if (get_user(instr, (u32 __user *)pc)) {
+ goto die_sig;
}
-
- } else if ((get_user(instr, (u32 __user *)pc))) {
- goto die_sig;
+ } else {
+ /* kernel mode */
+ instr = *((u32 *)pc);
}
if (call_undef_hook(regs, instr) == 0)