[ARM] 4183/1: do_undefinstr: read svc undefined instructions with svc privileges
authorDan Williams <dan.j.williams@intel.com>
Tue, 13 Feb 2007 16:11:34 +0000 (17:11 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 14 Feb 2007 15:21:22 +0000 (15:21 +0000)
do_undefinstr currently does not expect undefined instructions in kernel
code, since it always uses get_user() to read the instruction.

Dereference the 'pc' pointer directly in the SVC case.

Per Nicolas Pitre's note, kernel code is never in thumb mode.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/traps.c

index 329609b84d3bee3717069fe497bbe8fbe0797814..24095601359b94e04b9d8b83b2b9ab70cb9a2135 100644 (file)
@@ -282,7 +282,10 @@ asmlinkage void do_undefinstr(struct pt_regs *regs)
        regs->ARM_pc -= correction;
 
        pc = (void __user *)instruction_pointer(regs);
-       if (thumb_mode(regs)) {
+
+       if (processor_mode(regs) == SVC_MODE) {
+               instr = *(u32 *) pc;
+       } else if (thumb_mode(regs)) {
                get_user(instr, (u16 __user *)pc);
        } else {
                get_user(instr, (u32 __user *)pc);