Commit 8b1cec3e authored by David S. Miller's avatar David S. Miller

[SPARC32]: Synchronize with 2.5.x changes

- Some places need to include sched.h because the already include ptrace.h
- CLONE_{SET,CLEAR}TID support
- Clear PT_DTRACE when execve succeeds.
- Add security bits to ptrace
- Add sys_security to syscall tables.
parent 76ba4756
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/sched.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/linkage.h> #include <linux/linkage.h>
......
...@@ -508,6 +508,8 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -508,6 +508,8 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
#endif #endif
} }
p->user_tid = NULL;
/* Calculate offset to stack_frame & pt_regs */ /* Calculate offset to stack_frame & pt_regs */
stack_offset = THREAD_SIZE - TRACEREG_SZ; stack_offset = THREAD_SIZE - TRACEREG_SZ;
...@@ -581,6 +583,16 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -581,6 +583,16 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
/* Set the return value for the parent. */ /* Set the return value for the parent. */
regs->u_regs[UREG_I1] = 0; regs->u_regs[UREG_I1] = 0;
if (!(clone_flags & (CLONE_SETTID | CLONE_CLEARTID)))
return 0;
if (clone_flags & CLONE_SETTID)
if (put_user(p->pid, (int *)childregs->u_regs[UREG_G2]))
return -EFAULT;
if (clone_flags & CLONE_CLEARTID)
p->user_tid = (int *) childregs->u_regs[UREG_G2];
return 0; return 0;
} }
...@@ -681,6 +693,8 @@ asmlinkage int sparc_execve(struct pt_regs *regs) ...@@ -681,6 +693,8 @@ asmlinkage int sparc_execve(struct pt_regs *regs)
error = do_execve(filename, (char **) regs->u_regs[base + UREG_I1], error = do_execve(filename, (char **) regs->u_regs[base + UREG_I1],
(char **) regs->u_regs[base + UREG_I2], regs); (char **) regs->u_regs[base + UREG_I2], regs);
putname(filename); putname(filename);
if (error == 0)
current->ptrace &= ~PT_DTRACE;
out: out:
return error; return error;
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/user.h> #include <linux/user.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/security.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -283,11 +284,19 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -283,11 +284,19 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
} }
#endif #endif
if(request == PTRACE_TRACEME) { if(request == PTRACE_TRACEME) {
int ret;
/* are we already being traced? */ /* are we already being traced? */
if (current->ptrace & PT_PTRACED) { if (current->ptrace & PT_PTRACED) {
pt_error_return(regs, EPERM); pt_error_return(regs, EPERM);
goto out; goto out;
} }
ret = security_ops->ptrace(current->parent, current);
if (ret) {
pt_error_return(regs, -ret);
goto out;
}
/* set the ptrace bit in the process flags. */ /* set the ptrace bit in the process flags. */
current->ptrace |= PT_PTRACED; current->ptrace |= PT_PTRACED;
pt_succ_return(regs, 0); pt_succ_return(regs, 0);
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/ptrace.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h> #include <linux/init.h>
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/ptrace.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/random.h> #include <linux/random.h>
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/ptrace.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/slab.h> #include <linux/slab.h>
......
...@@ -49,7 +49,7 @@ sys_call_table: ...@@ -49,7 +49,7 @@ sys_call_table:
/*140*/ .long sys_sendfile64, sys_nis_syscall, sys_futex, sys_gettid, sys_getrlimit /*140*/ .long sys_sendfile64, sys_nis_syscall, sys_futex, sys_gettid, sys_getrlimit
/*145*/ .long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write /*145*/ .long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
/*150*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 /*150*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
/*155*/ .long sys_fcntl64, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount /*155*/ .long sys_fcntl64, sys_security, sys_statfs, sys_fstatfs, sys_oldumount
/*160*/ .long sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall /*160*/ .long sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
/*165*/ .long sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_setxattr /*165*/ .long sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_setxattr
/*170*/ .long sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents /*170*/ .long sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/sched.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/mman.h> #include <linux/mman.h>
#include <linux/threads.h> #include <linux/threads.h>
......
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
#define __NR_poll 153 /* Common */ #define __NR_poll 153 /* Common */
#define __NR_getdents64 154 /* Linux specific */ #define __NR_getdents64 154 /* Linux specific */
#define __NR_fcntl64 155 /* Linux sparc32 Specific */ #define __NR_fcntl64 155 /* Linux sparc32 Specific */
/* #define __NR_getdirentries 156 SunOS Specific */ #define __NR_security 156 /* getdirentries under SunOS */
#define __NR_statfs 157 /* Common */ #define __NR_statfs 157 /* Common */
#define __NR_fstatfs 158 /* Common */ #define __NR_fstatfs 158 /* Common */
#define __NR_umount 159 /* Common */ #define __NR_umount 159 /* Common */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment