get_user() should be called only for user_mode undef instruction.
Change-Id: Ia654783de0cf72abac6847ac9630236f9f0d6ebb
Signed-off-by: Peng Du <pdu@nvidia.com>
Reviewed-on: http://git-master/r/441348
Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
Reviewed-by: Bo Yan <byan@nvidia.com>
/* check for AArch32 breakpoint instructions */
if (!aarch32_break_handler(regs))
return;
/* 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))
- 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)
}
if (call_undef_hook(regs, instr) == 0)