]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/mips/kernel/ptrace.c
Merge git://oss.sgi.com:8090/oss/git/xfs-2.6
[linux-2.6-omap-h63xx.git] / arch / mips / kernel / ptrace.c
index a2f899c2f4d495cd224b1e0966b3a201be987d87..0b571a5b4b83a7705a3a0d06ffd97de88432a866 100644 (file)
@@ -124,7 +124,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
                        if (tsk_used_math(child)) {
                                fpureg_t *fregs = get_fpu_regs(child);
 
-#ifdef CONFIG_MIPS32
+#ifdef CONFIG_32BIT
                                /*
                                 * The odd registers are actually the high
                                 * order bits of the values stored in the even
@@ -135,7 +135,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
                                else
                                        tmp = (unsigned long) (fregs[(addr - 32)] & 0xffffffff);
 #endif
-#ifdef CONFIG_MIPS64
+#ifdef CONFIG_64BIT
                                tmp = fregs[addr - FPR_BASE];
 #endif
                        } else {
@@ -213,7 +213,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
                                       sizeof(child->thread.fpu.hard));
                                child->thread.fpu.hard.fcr31 = 0;
                        }
-#ifdef CONFIG_MIPS32
+#ifdef CONFIG_32BIT
                        /*
                         * The odd registers are actually the high order bits
                         * of the values stored in the even registers - unless
@@ -227,7 +227,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
                                fregs[addr - FPR_BASE] |= data;
                        }
 #endif
-#ifdef CONFIG_MIPS64
+#ifdef CONFIG_64BIT
                        fregs[addr - FPR_BASE] = data;
 #endif
                        break;
@@ -301,25 +301,38 @@ out:
        return ret;
 }
 
+static inline int audit_arch(void)
+{
+#ifdef CONFIG_CPU_LITTLE_ENDIAN
+#ifdef CONFIG_64BIT
+       if (!(current->thread.mflags & MF_32BIT_REGS))
+               return AUDIT_ARCH_MIPSEL64;
+#endif /* MIPS64 */
+       return AUDIT_ARCH_MIPSEL;
+
+#else /* big endian... */
+#ifdef CONFIG_64BIT
+       if (!(current->thread.mflags & MF_32BIT_REGS))
+               return AUDIT_ARCH_MIPS64;
+#endif /* MIPS64 */
+       return AUDIT_ARCH_MIPS;
+
+#endif /* endian */
+}
+
 /*
  * Notification of system call entry/exit
  * - triggered by current->work.syscall_trace
  */
 asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
 {
-       if (unlikely(current->audit_context)) {
-               if (!entryexit)
-                       audit_syscall_entry(current, regs->regs[2],
-                                           regs->regs[4], regs->regs[5],
-                                           regs->regs[6], regs->regs[7]);
-               else
-                       audit_syscall_exit(current, regs->regs[2]);
-       }
+       if (unlikely(current->audit_context) && entryexit)
+               audit_syscall_exit(current, AUDITSC_RESULT(regs->regs[2]), regs->regs[2]);
 
        if (!test_thread_flag(TIF_SYSCALL_TRACE))
-               return;
+               goto out;
        if (!(current->ptrace & PT_PTRACED))
-               return;
+               goto out;
 
        /* The 0x80 provides a way for the tracing parent to distinguish
           between a syscall stop and SIGTRAP delivery */
@@ -335,4 +348,9 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
                send_sig(current->exit_code, current, 1);
                current->exit_code = 0;
        }
+ out:
+       if (unlikely(current->audit_context) && !entryexit)
+               audit_syscall_entry(current, audit_arch(), regs->regs[2],
+                                   regs->regs[4], regs->regs[5],
+                                   regs->regs[6], regs->regs[7]);
 }