*/
#include <linux/config.h>
+#include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/errno.h>
#include <linux/kernel_stat.h>
p->thread.smp_lock_pc = 0;
#endif
+ p->user_tid = NULL;
+
/* Calculate offset to stack_frame & pt_regs */
child_trap_frame = ((char *)t) + (THREAD_SIZE - (TRACEREG_SZ+REGWIN_SZ));
memcpy(child_trap_frame, (((struct reg_window *)regs)-1), (TRACEREG_SZ+REGWIN_SZ));
/* Set the second return value for the parent. */
regs->u_regs[UREG_I1] = 0;
+ if (!(clone_flags & (CLONE_SETTID | CLONE_CLEARTID)))
+ return 0;
+
+ if (t->flags & _TIF_32BIT)
+ t->kregs->u_regs[UREG_G2] &= 0xffffffff;
+
+ if (clone_flags & CLONE_SETTID)
+ if (put_user(p->pid, (int *)t->kregs->u_regs[UREG_G2]))
+ return -EFAULT;
+
+ if (clone_flags & CLONE_CLEARTID)
+ p->user_tid = (int *) t->kregs->u_regs[UREG_G2];
+
return 0;
}
current_thread_info()->xfsr[0] = 0;
current_thread_info()->fpsaved[0] = 0;
regs->tstate &= ~TSTATE_PEF;
+ current->ptrace &= ~PT_DTRACE;
}
out:
return error;
#include <linux/user.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
+#include <linux/security.h>
#include <asm/asi.h>
#include <asm/pgtable.h>
}
#endif
if (request == PTRACE_TRACEME) {
+ int ret;
+
/* are we already being traced? */
if (current->ptrace & PT_PTRACED) {
pt_error_return(regs, EPERM);
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. */
current->ptrace |= PT_PTRACED;
pt_succ_return(regs, 0);
#include <asm/uaccess.h>
#include <asm/fpumacro.h>
#include <asm/semaphore.h>
+#include <asm/mmu_context.h>
#include <net/scm.h>
int retval;
int i;
- bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
- memset(bprm.page, 0, MAX_ARG_PAGES * sizeof(bprm.page[0]));
-
file = open_exec(filename);
retval = PTR_ERR(file);
if (IS_ERR(file))
return retval;
+ bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
+ memset(bprm.page, 0, MAX_ARG_PAGES * sizeof(bprm.page[0]));
+
bprm.file = file;
bprm.filename = filename;
bprm.sh_bang = 0;
bprm.loader = 0;
bprm.exec = 0;
-
+ bprm.security = NULL;
bprm.mm = mm_alloc();
retval = -ENOMEM;
if (!bprm.mm)
goto out_file;
+ retval = init_new_context(current, bprm.mm);
+ if (retval < 0)
+ goto out_mm;
+
bprm.argc = count32(argv, bprm.p / sizeof(u32));
if ((retval = bprm.argc) < 0)
goto out_mm;
if ((retval = bprm.envc) < 0)
goto out_mm;
+ retval = security_ops->bprm_alloc_security(&bprm);
+ if (retval)
+ goto out;
+
retval = prepare_binprm(&bprm);
if (retval < 0)
goto out;
goto out;
retval = search_binary_handler(&bprm, regs);
- if (retval >= 0)
+ if (retval >= 0) {
/* execve success */
+ security_ops->bprm_free_security(&bprm);
return retval;
+ }
out:
/* Something went wrong, return the inode and free the argument pages*/
__free_page(page);
}
+ if (bprm.security)
+ security_ops->bprm_free_security(&bprm);
+
out_mm:
mmdrop(bprm.mm);
current_thread_info()->xfsr[0] = 0;
current_thread_info()->fpsaved[0] = 0;
regs->tstate &= ~TSTATE_PEF;
+ current->ptrace &= ~PT_DTRACE;
}
out:
return error;
/*140*/ .word sys32_sendfile64, sys_nis_syscall, sys_futex, sys_gettid, sys32_getrlimit
.word sys32_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write
/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
- .word sys32_fcntl64, sys_nis_syscall, sys32_statfs, sys32_fstatfs, sys_oldumount
+ .word sys32_fcntl64, sys_security, sys32_statfs, sys32_fstatfs, sys_oldumount
/*160*/ .word sys32_sched_setaffinity, sys32_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
.word sys_quotactl, sys_nis_syscall, sys32_mount, sys_ustat, sys_setxattr
/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents
/*140*/ .word sys_sendfile64, sys_getpeername, sys_futex, sys_gettid, sys_getrlimit
.word sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
/*150*/ .word sys_getsockname, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
- .word sys_nis_syscall, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
+ .word sys_nis_syscall, sys_security, sys_statfs, sys_fstatfs, sys_oldumount
/*160*/ .word sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_utrap_install
.word sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_setxattr
/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
#include <linux/string.h>
#include <linux/types.h>
+#include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/mman.h>
#include <linux/signal.h>
#define __NR_poll 153 /* Common */
#define __NR_getdents64 154 /* Linux 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_fstatfs 158 /* Common */
#define __NR_umount 159 /* Common */