diff options
Diffstat (limited to 'sys/compat/linux')
71 files changed, 370 insertions, 331 deletions
diff --git a/sys/compat/linux/arch/alpha/linux_machdep.c b/sys/compat/linux/arch/alpha/linux_machdep.c index a87a8162f56..9871f869417 100644 --- a/sys/compat/linux/arch/alpha/linux_machdep.c +++ b/sys/compat/linux/arch/alpha/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.35 2006/07/23 22:06:08 ad Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.36 2007/02/09 21:55:18 ad Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.35 2006/07/23 22:06:08 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.36 2007/02/09 21:55:18 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -62,7 +62,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.35 2006/07/23 22:06:08 ad Exp $" #include <sys/mount.h> #include <sys/vnode.h> #include <sys/device.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <sys/filedesc.h> #include <sys/exec_elf.h> @@ -125,12 +124,12 @@ setup_linux_rt_sigframe(struct trapframe *tf, int sig, const sigset_t *mask) struct lwp *l = curlwp; struct proc *p = l->l_proc; struct linux_rt_sigframe *sfp, sigframe; - int onstack; + int onstack, error; int fsize, rndfsize; extern char linux_rt_sigcode[], linux_rt_esigcode[]; /* Do we need to jump onto the signal stack? */ - onstack = (p->p_sigctx.ps_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && + onstack = (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0; /* Allocate space for the signal handler context. */ @@ -139,8 +138,8 @@ setup_linux_rt_sigframe(struct trapframe *tf, int sig, const sigset_t *mask) if (onstack) sfp = (struct linux_rt_sigframe *) - ((caddr_t)p->p_sigctx.ps_sigstk.ss_sp + - p->p_sigctx.ps_sigstk.ss_size); + ((caddr_t)l->l_sigstk.ss_sp + + l->l_sigstk.ss_size); else sfp = (struct linux_rt_sigframe *)(alpha_pal_rdusp()); sfp = (struct linux_rt_sigframe *)((caddr_t)sfp - rndfsize); @@ -188,7 +187,12 @@ setup_linux_rt_sigframe(struct trapframe *tf, int sig, const sigset_t *mask) sigframe.info.lsi_pid = p->p_pid; sigframe.info.lsi_uid = kauth_cred_geteuid(l->l_cred); /* Use real uid here? */ - if (copyout((caddr_t)&sigframe, (caddr_t)sfp, fsize) != 0) { + sendsig_reset(l, sig); + mutex_exit(&p->p_smutex); + error = copyout((caddr_t)&sigframe, (caddr_t)sfp, fsize); + mutex_enter(&p->p_smutex); + + if (error != 0) { #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) printf("sendsig(%d): copyout failed on sig %d\n", @@ -215,7 +219,7 @@ setup_linux_rt_sigframe(struct trapframe *tf, int sig, const sigset_t *mask) /* Remember that we're now on the signal stack. */ if (onstack) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + l->l_sigstk.ss_flags |= SS_ONSTACK; } void setup_linux_sigframe(tf, sig, mask) @@ -226,12 +230,12 @@ void setup_linux_sigframe(tf, sig, mask) struct lwp *l = curlwp; struct proc *p = l->l_proc; struct linux_sigframe *sfp, sigframe; - int onstack; + int onstack, error; int fsize, rndfsize; extern char linux_sigcode[], linux_esigcode[]; /* Do we need to jump onto the signal stack? */ - onstack = (p->p_sigctx.ps_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && + onstack = (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0; /* Allocate space for the signal handler context. */ @@ -240,8 +244,8 @@ void setup_linux_sigframe(tf, sig, mask) if (onstack) sfp = (struct linux_sigframe *) - ((caddr_t)p->p_sigctx.ps_sigstk.ss_sp + - p->p_sigctx.ps_sigstk.ss_size); + ((caddr_t)l->l_sigstk.ss_sp + + l->l_sigstk.ss_size); else sfp = (struct linux_sigframe *)(alpha_pal_rdusp()); sfp = (struct linux_sigframe *)((caddr_t)sfp - rndfsize); @@ -276,7 +280,12 @@ void setup_linux_sigframe(tf, sig, mask) sigframe.sf_sc.sc_traparg_a1 = tf->tf_regs[FRAME_A1]; sigframe.sf_sc.sc_traparg_a2 = tf->tf_regs[FRAME_A2]; - if (copyout((caddr_t)&sigframe, (caddr_t)sfp, fsize) != 0) { + sendsig_reset(l, sig); + mutex_exit(&p->p_smutex); + error = copyout((caddr_t)&sigframe, (caddr_t)sfp, fsize); + mutex_enter(&p->p_smutex); + + if (error != 0) { #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) printf("sendsig(%d): copyout failed on sig %d\n", @@ -303,7 +312,7 @@ void setup_linux_sigframe(tf, sig, mask) /* Remember that we're now on the signal stack. */ if (onstack) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + l->l_sigstk.ss_flags |= SS_ONSTACK; } /* @@ -376,20 +385,22 @@ int linux_restore_sigcontext(struct lwp *l, struct linux_sigcontext context, sigset_t *mask) { - struct proc *p = l->l_proc; + /* * Linux doesn't (yet) have alternate signal stacks. * However, the OSF/1 sigcontext which they use has * an onstack member. This could be needed in the future. */ + mutex_enter(&p->p_smutex); if (context.sc_onstack & LINUX_SA_ONSTACK) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + l->l_sigstk.ss_flags |= SS_ONSTACK; else - p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK; + l->l_sigstk.ss_flags &= ~SS_ONSTACK; /* Reset the signal mask */ - (void) sigprocmask1(p, SIG_SETMASK, mask, 0); + (void) sigprocmask1(l, SIG_SETMASK, mask, 0); + mutex_exit(&p->p_smutex); /* * Check for security violations. diff --git a/sys/compat/linux/arch/alpha/linux_pipe.c b/sys/compat/linux/arch/alpha/linux_pipe.c index 9de68ed4b07..b0664a6b673 100644 --- a/sys/compat/linux/arch/alpha/linux_pipe.c +++ b/sys/compat/linux/arch/alpha/linux_pipe.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_pipe.c,v 1.9 2005/12/11 12:20:12 christos Exp $ */ +/* $NetBSD: linux_pipe.c,v 1.10 2007/02/09 21:55:18 ad Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.9 2005/12/11 12:20:12 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.10 2007/02/09 21:55:18 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -48,7 +48,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.9 2005/12/11 12:20:12 christos Exp #include <sys/mount.h> #include <sys/proc.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/arch/alpha/linux_syscalls.c b/sys/compat/linux/arch/alpha/linux_syscalls.c index 9981bb87de2..fad3454ddcb 100644 --- a/sys/compat/linux/arch/alpha/linux_syscalls.c +++ b/sys/compat/linux/arch/alpha/linux_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_syscalls.c,v 1.62 2006/09/01 21:19:44 matt Exp $ */ +/* $NetBSD: linux_syscalls.c,v 1.63 2007/02/09 21:55:18 ad Exp $ */ /* * System call names. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.62 2006/09/01 21:19:44 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.63 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT) @@ -21,7 +21,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.62 2006/09/01 21:19:44 matt Exp #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_signal.h> diff --git a/sys/compat/linux/arch/alpha/linux_sysent.c b/sys/compat/linux/arch/alpha/linux_sysent.c index 6fc2abb8145..4fae92f1257 100644 --- a/sys/compat/linux/arch/alpha/linux_sysent.c +++ b/sys/compat/linux/arch/alpha/linux_sysent.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sysent.c,v 1.61 2006/09/01 21:19:44 matt Exp $ */ +/* $NetBSD: linux_sysent.c,v 1.62 2007/02/09 21:55:18 ad Exp $ */ /* * System call switch table. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.61 2006/09/01 21:19:44 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.62 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" @@ -20,7 +20,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.61 2006/09/01 21:19:44 matt Exp $ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_signal.h> diff --git a/sys/compat/linux/arch/alpha/syscalls.master b/sys/compat/linux/arch/alpha/syscalls.master index 8dc5574b84d..8f7a42e7ea1 100644 --- a/sys/compat/linux/arch/alpha/syscalls.master +++ b/sys/compat/linux/arch/alpha/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.55 2006/09/01 20:58:18 matt Exp $ + $NetBSD: syscalls.master,v 1.56 2007/02/09 21:55:18 ad Exp $ ; ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -68,7 +68,6 @@ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/arch/amd64/linux_commons.c b/sys/compat/linux/arch/amd64/linux_commons.c index 41a6b724cc8..56ad730e998 100644 --- a/sys/compat/linux/arch/amd64/linux_commons.c +++ b/sys/compat/linux/arch/amd64/linux_commons.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_commons.c,v 1.5 2006/02/09 19:18:56 manu Exp $ */ +/* $NetBSD: linux_commons.c,v 1.6 2007/02/09 21:55:18 ad Exp $ */ /* * This file includes C files from the common @@ -13,7 +13,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.5 2006/02/09 19:18:56 manu Exp $"); +__KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.6 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" @@ -26,7 +26,6 @@ __KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.5 2006/02/09 19:18:56 manu Exp $ #include <sys/param.h> #include <sys/mount.h> #include <sys/signal.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_signal.h> diff --git a/sys/compat/linux/arch/amd64/linux_machdep.c b/sys/compat/linux/arch/amd64/linux_machdep.c index e9d59bd65d7..898727e59d7 100644 --- a/sys/compat/linux/arch/amd64/linux_machdep.c +++ b/sys/compat/linux/arch/amd64/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.15 2006/09/20 09:54:55 manu Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.16 2007/02/09 21:55:18 ad Exp $ */ /*- * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.15 2006/09/20 09:54:55 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.16 2007/02/09 21:55:18 ad Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -124,7 +124,7 @@ linux_sendsig(ksi, mask) struct lwp *l = curlwp; struct proc *p = l->l_proc; struct sigacts *ps = p->p_sigacts; - int onstack; + int onstack, error; int sig = ksi->ksi_signo; struct linux_rt_sigframe *sfp, sigframe; struct linux__fpstate *fpsp, fpstate; @@ -134,6 +134,9 @@ linux_sendsig(ksi, mask) linux_sigset_t lmask; char *sp; int error; + sigset_t tmask; + + tmask = *mask; /* Do we need to jump onto the signal stack? */ onstack = @@ -156,9 +159,9 @@ linux_sendsig(ksi, mask) (((long)sp - sizeof(struct linux__fpstate)) & ~0xfUL); fpsp = (struct linux__fpstate *)sp; + mutex_exit(&p->p_smutex); (void)process_read_fpregs(l, &fpregs); bzero(&fpstate, sizeof(fpstate)); - fpstate.cwd = fpregs.fp_fcw; fpstate.swd = fpregs.fp_fsw; fpstate.twd = fpregs.fp_ftw; @@ -171,8 +174,10 @@ linux_sendsig(ksi, mask) sizeof(fpstate.st_space)); memcpy(&fpstate.xmm_space, &fpregs.fp_xmm, sizeof(fpstate.xmm_space)); + error = copyout(&fpstate, fpsp, sizeof(fpstate)); + mutex_enter(&p->p_smutex) - if ((error = copyout(&fpstate, fpsp, sizeof(fpstate))) != 0) { + if (error != 0) { sigexit(l, SIGILL); return; } @@ -287,7 +292,12 @@ linux_sendsig(ksi, mask) break; } - if ((error = copyout(&sigframe, sp, sizeof(sigframe))) != 0) { + sendsig_reset(l, sig); + mutex_exit(&p->p_smutex); + error = copyout(&sigframe, sp, sizeof(sigframe)); + mutex_enter(&p->p_smutex); + + if (error != 0) { sigexit(l, SIGILL); return; } @@ -371,6 +381,7 @@ linux_sys_rt_sigreturn(l, v, retval) fp = (struct linux_rt_sigframe *)(tf->tf_rsp - 8); if ((error = copyin(fp, &frame, sizeof(frame))) != 0) { + mutex_enter(&l->l_proc->p_smutex); sigexit(l, SIGILL); return error; } @@ -431,6 +442,7 @@ linux_sys_rt_sigreturn(l, v, retval) if (lsigctx->fpstate != NULL) { error = copyin(lsigctx->fpstate, &fpstate, sizeof(fpstate)); if (error != 0) { + mutex_enter(&l->l_proc->p_smutex); sigexit(l, SIGILL); return error; } @@ -465,7 +477,11 @@ linux_sys_rt_sigreturn(l, v, retval) /* * And let setucontext deal with that. */ - return setucontext(l, &uctx); + mutex_enter(&l->l_proc->p_smutex); + error = setucontext(l, &uctx); + mutex_exit(&l->l_proc->p_smutex); + + return error; } int diff --git a/sys/compat/linux/arch/amd64/linux_syscalls.c b/sys/compat/linux/arch/amd64/linux_syscalls.c index d468053738c..cd26eb3de65 100644 --- a/sys/compat/linux/arch/amd64/linux_syscalls.c +++ b/sys/compat/linux/arch/amd64/linux_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_syscalls.c,v 1.16 2006/09/01 21:19:45 matt Exp $ */ +/* $NetBSD: linux_syscalls.c,v 1.17 2007/02/09 21:55:18 ad Exp $ */ /* * System call names. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.16 2006/09/01 21:19:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.17 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT) @@ -20,7 +20,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.16 2006/09/01 21:19:45 matt Exp #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_mmap.h> diff --git a/sys/compat/linux/arch/amd64/linux_sysent.c b/sys/compat/linux/arch/amd64/linux_sysent.c index 330b915de78..b7c4394a06c 100644 --- a/sys/compat/linux/arch/amd64/linux_sysent.c +++ b/sys/compat/linux/arch/amd64/linux_sysent.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sysent.c,v 1.16 2006/09/01 21:19:45 matt Exp $ */ +/* $NetBSD: linux_sysent.c,v 1.17 2007/02/09 21:55:18 ad Exp $ */ /* * System call switch table. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.16 2006/09/01 21:19:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.17 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" @@ -19,7 +19,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.16 2006/09/01 21:19:45 matt Exp $ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_mmap.h> diff --git a/sys/compat/linux/arch/amd64/syscalls.master b/sys/compat/linux/arch/amd64/syscalls.master index d2177c565fe..6b2d287dcff 100644 --- a/sys/compat/linux/arch/amd64/syscalls.master +++ b/sys/compat/linux/arch/amd64/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.15 2006/09/01 20:58:18 matt Exp $ + $NetBSD: syscalls.master,v 1.16 2007/02/09 21:55:18 ad Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -43,7 +43,6 @@ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/arch/arm/linux_commons.c b/sys/compat/linux/arch/arm/linux_commons.c index 412e26adea1..48f08af5b3e 100644 --- a/sys/compat/linux/arch/arm/linux_commons.c +++ b/sys/compat/linux/arch/arm/linux_commons.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_commons.c,v 1.3 2003/01/18 08:02:47 thorpej Exp $ */ +/* $NetBSD: linux_commons.c,v 1.4 2007/02/09 21:55:18 ad Exp $ */ /* * This file includes C files from the common @@ -13,7 +13,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.3 2003/01/18 08:02:47 thorpej Exp $"); +__KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.4 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" @@ -26,7 +26,6 @@ __KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.3 2003/01/18 08:02:47 thorpej Ex #include <sys/param.h> #include <sys/mount.h> #include <sys/signal.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include "../../common/linux_pipe.c" diff --git a/sys/compat/linux/arch/arm/linux_machdep.c b/sys/compat/linux/arch/arm/linux_machdep.c index ff0dfc7a46a..73defd1f666 100644 --- a/sys/compat/linux/arch/arm/linux_machdep.c +++ b/sys/compat/linux/arch/arm/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.18 2006/08/23 21:16:58 bjh21 Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.19 2007/02/09 21:55:18 ad Exp $ */ /*- * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <sys/param.h> -__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.18 2006/08/23 21:16:58 bjh21 Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.19 2007/02/09 21:55:18 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -58,7 +58,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.18 2006/08/23 21:16:58 bjh21 Exp #include <sys/mount.h> #include <sys/vnode.h> #include <sys/device.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <sys/filedesc.h> #include <sys/exec_elf.h> @@ -92,7 +91,7 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) struct proc *p = l->l_proc; struct trapframe *tf; struct linux_sigframe *fp, frame; - int onstack; + int onstack, error; const int sig = ksi->ksi_signo; sig_t catcher = SIGACTION(p, sig).sa_handler; @@ -105,13 +104,13 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) /* Do we need to jump onto the signal stack? */ onstack = - (p->p_sigctx.ps_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && + (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0; /* Allocate space for the signal handler context. */ if (onstack) - fp = (struct linux_sigframe *)((caddr_t)p->p_sigctx.ps_sigstk.ss_sp + - p->p_sigctx.ps_sigstk.ss_size); + fp = (struct linux_sigframe *)((caddr_t)l->l_sigstk.ss_sp + + l->l_sigstk.ss_size); else fp = (struct linux_sigframe *)tf->tf_usr_sp; fp--; @@ -154,8 +153,13 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) frame.sf_sc.sc_trapno = 0; frame.sf_sc.sc_error_code = 0; frame.sf_sc.sc_fault_address = (u_int32_t) ksi->ksi_addr; + sendsig_reset(l, sig); - if (copyout(&frame, fp, sizeof(frame)) != 0) { + mutex_exit(&p->p_smutex); + error = copyout(&frame, fp, sizeof(frame)); + mutex_enter(&p->p_smutex); + + if (error != 0) { /* * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. @@ -175,7 +179,7 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) /* Remember that we're now on the signal stack. */ if (onstack) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + l->l_sigstk.ss_flags |= SS_ONSTACK; } @@ -250,13 +254,17 @@ linux_sys_sigreturn(l, v, retval) tf->tf_pc = frame.sf_sc.sc_pc; tf->tf_spsr = frame.sf_sc.sc_cpsr; + mutex_enter(&p->p_smutex); + /* Restore signal stack. */ - p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK; + l->l_sigstk.ss_flags &= ~SS_ONSTACK; /* Restore signal mask. */ linux_old_extra_to_native_sigset(&mask, &frame.sf_sc.sc_mask, frame.sf_extramask); - (void) sigprocmask1(p, SIG_SETMASK, &mask, 0); + (void) sigprocmask1(l, SIG_SETMASK, &mask, 0); + + mutex_exit(&p->p_smutex); return (EJUSTRETURN); } diff --git a/sys/compat/linux/arch/arm/linux_ptrace.c b/sys/compat/linux/arch/arm/linux_ptrace.c index 1a065061491..1d7a8d7dacf 100644 --- a/sys/compat/linux/arch/arm/linux_ptrace.c +++ b/sys/compat/linux/arch/arm/linux_ptrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ptrace.c,v 1.6 2006/09/01 21:20:46 matt Exp $ */ +/* $NetBSD: linux_ptrace.c,v 1.7 2007/02/09 21:55:18 ad Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.6 2006/09/01 21:20:46 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.7 2007/02/09 21:55:18 ad Exp $"); #include <sys/param.h> #include <sys/malloc.h> @@ -46,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.6 2006/09/01 21:20:46 matt Exp $" #include <sys/proc.h> #include <sys/ptrace.h> #include <sys/systm.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <uvm/uvm_extern.h> diff --git a/sys/compat/linux/arch/arm/linux_syscalls.c b/sys/compat/linux/arch/arm/linux_syscalls.c index 25de9b2303c..f98a90b4689 100644 --- a/sys/compat/linux/arch/arm/linux_syscalls.c +++ b/sys/compat/linux/arch/arm/linux_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_syscalls.c,v 1.28 2006/09/01 21:19:45 matt Exp $ */ +/* $NetBSD: linux_syscalls.c,v 1.29 2007/02/09 21:55:18 ad Exp $ */ /* * System call names. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.28 2006/09/01 21:19:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.29 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT) @@ -19,7 +19,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.28 2006/09/01 21:19:45 matt Exp #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_mmap.h> diff --git a/sys/compat/linux/arch/arm/linux_sysent.c b/sys/compat/linux/arch/arm/linux_sysent.c index beb7c985e7b..f1787c67f39 100644 --- a/sys/compat/linux/arch/arm/linux_sysent.c +++ b/sys/compat/linux/arch/arm/linux_sysent.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sysent.c,v 1.28 2006/09/01 21:19:45 matt Exp $ */ +/* $NetBSD: linux_sysent.c,v 1.29 2007/02/09 21:55:18 ad Exp $ */ /* * System call switch table. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.28 2006/09/01 21:19:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.29 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_43.h" @@ -18,7 +18,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.28 2006/09/01 21:19:45 matt Exp $ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_mmap.h> diff --git a/sys/compat/linux/arch/arm/syscalls.master b/sys/compat/linux/arch/arm/syscalls.master index 683967bdc9f..4985e6c2177 100644 --- a/sys/compat/linux/arch/arm/syscalls.master +++ b/sys/compat/linux/arch/arm/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.26 2006/09/01 20:58:18 matt Exp $ + $NetBSD: syscalls.master,v 1.27 2007/02/09 21:55:18 ad Exp $ ; Derived from sys/compat/linux/arch/*/syscalls.master ; and from Linux 2.4.12 arch/arm/kernel/calls.S @@ -43,7 +43,6 @@ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/arch/i386/linux_commons.c b/sys/compat/linux/arch/i386/linux_commons.c index c76830e1559..bd705464d08 100644 --- a/sys/compat/linux/arch/i386/linux_commons.c +++ b/sys/compat/linux/arch/i386/linux_commons.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_commons.c,v 1.7 2003/01/18 08:02:47 thorpej Exp $ */ +/* $NetBSD: linux_commons.c,v 1.8 2007/02/09 21:55:18 ad Exp $ */ /* * This file includes C files from the common @@ -13,7 +13,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.7 2003/01/18 08:02:47 thorpej Exp $"); +__KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.8 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" @@ -26,7 +26,6 @@ __KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.7 2003/01/18 08:02:47 thorpej Ex #include <sys/param.h> #include <sys/mount.h> #include <sys/signal.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include "../../common/linux_pipe.c" diff --git a/sys/compat/linux/arch/i386/linux_machdep.c b/sys/compat/linux/arch/i386/linux_machdep.c index 7666df3dabe..3fdd91dbf89 100644 --- a/sys/compat/linux/arch/i386/linux_machdep.c +++ b/sys/compat/linux/arch/i386/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.121 2007/01/29 01:52:44 hubertf Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.122 2007/02/09 21:55:18 ad Exp $ */ /*- * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.121 2007/01/29 01:52:44 hubertf Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.122 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_vm86.h" @@ -62,7 +62,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.121 2007/01/29 01:52:44 hubertf #include <sys/mount.h> #include <sys/vnode.h> #include <sys/device.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <sys/filedesc.h> #include <sys/exec_elf.h> @@ -275,11 +274,11 @@ linux_rt_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) struct proc *p = l->l_proc; struct trapframe *tf; struct linux_rt_sigframe *fp, frame; - int onstack; + int onstack, error; linux_siginfo_t *lsi; int sig = ksi->ksi_signo; sig_t catcher = SIGACTION(p, sig).sa_handler; - struct sigaltstack *sas = &p->p_sigctx.ps_sigstk; + struct sigaltstack *sas = &l->l_sigstk; tf = l->l_md.md_regs; /* Do we need to jump onto the signal stack? */ @@ -345,8 +344,13 @@ linux_rt_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) /* Save register context. */ linux_save_ucontext(l, tf, mask, sas, &frame.sf_uc); + sendsig_reset(l, sig); - if (copyout(&frame, fp, sizeof(frame)) != 0) { + mutex_exit(&p->p_smutex); + error = copyout(&frame, fp, sizeof(frame)); + mutex_enter(&p->p_smutex); + + if (error != 0) { /* * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. @@ -381,10 +385,10 @@ linux_old_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) struct proc *p = l->l_proc; struct trapframe *tf; struct linux_sigframe *fp, frame; - int onstack; + int onstack, error; int sig = ksi->ksi_signo; sig_t catcher = SIGACTION(p, sig).sa_handler; - struct sigaltstack *sas = &p->p_sigctx.ps_sigstk; + struct sigaltstack *sas = &l->l_sigstk; tf = l->l_md.md_regs; @@ -408,8 +412,13 @@ linux_old_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) frame.sf_sig = native_to_linux_signo[sig]; linux_save_sigcontext(l, tf, mask, &frame.sf_sc); + sendsig_reset(l, sig); + + mutex_exit(&p->p_smutex); + error = copyout(&frame, fp, sizeof(frame)); + mutex_enter(&p->p_smutex); - if (copyout(&frame, fp, sizeof(frame)) != 0) { + if (error != 0) { /* * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. @@ -497,7 +506,7 @@ linux_restore_sigcontext(struct lwp *l, struct linux_sigcontext *scp, register_t *retval) { struct proc *p = l->l_proc; - struct sigaltstack *sas = &p->p_sigctx.ps_sigstk; + struct sigaltstack *sas = &l->l_sigstk; struct trapframe *tf; sigset_t mask; ssize_t ss_gap; @@ -555,6 +564,7 @@ linux_restore_sigcontext(struct lwp *l, struct linux_sigcontext *scp, * Linux really does it this way; it doesn't have space in sigframe * to save the onstack flag. */ + mutex_enter(&p->p_smutex); ss_gap = (ssize_t) ((caddr_t) scp->sc_esp_at_signal - (caddr_t) sas->ss_sp); if (ss_gap >= 0 && ss_gap < sas->ss_size) @@ -564,7 +574,9 @@ linux_restore_sigcontext(struct lwp *l, struct linux_sigcontext *scp, /* Restore signal mask. */ linux_old_to_native_sigset(&mask, &scp->sc_mask); - (void) sigprocmask1(p, SIG_SETMASK, &mask, 0); + (void) sigprocmask1(l, SIG_SETMASK, &mask, 0); + mutex_exit(&p->p_smutex); + DPRINTF(("sigreturn exit esp=%x eip=%x\n", tf->tf_esp, tf->tf_eip)); return EJUSTRETURN; } diff --git a/sys/compat/linux/arch/i386/linux_ptrace.c b/sys/compat/linux/arch/i386/linux_ptrace.c index a4eb25333e5..ddabe5cadf4 100644 --- a/sys/compat/linux/arch/i386/linux_ptrace.c +++ b/sys/compat/linux/arch/i386/linux_ptrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ptrace.c,v 1.15 2006/09/01 21:20:46 matt Exp $ */ +/* $NetBSD: linux_ptrace.c,v 1.16 2007/02/09 21:55:18 ad Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.15 2006/09/01 21:20:46 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.16 2007/02/09 21:55:18 ad Exp $"); #include <sys/param.h> #include <sys/malloc.h> @@ -45,7 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.15 2006/09/01 21:20:46 matt Exp $ #include <sys/proc.h> #include <sys/ptrace.h> #include <sys/systm.h> -#include <sys/sa.h> #include <sys/syscall.h> #include <sys/syscallargs.h> #include <uvm/uvm_extern.h> @@ -157,6 +156,8 @@ linux_sys_ptrace_arch(l, v, retval) (request != LINUX_PTRACE_SETFPREGS)) return EIO; + /* XXXAD locking */ + /* Find the process we're supposed to be operating on. */ if ((t = pfind(SCARG(uap, pid))) == NULL) return ESRCH; @@ -165,14 +166,14 @@ linux_sys_ptrace_arch(l, v, retval) * You can't do what you want to the process if: * (1) It's not being traced at all, */ - if (!ISSET(t->p_flag, P_TRACED)) + if (!ISSET(t->p_slflag, PSL_TRACED)) return EPERM; /* * (2) it's being traced by procfs (which has * different signal delivery semantics), */ - if (ISSET(t->p_flag, P_FSTRACE)) + if (ISSET(t->p_slflag, PSL_FSTRACE)) return EBUSY; /* @@ -184,7 +185,7 @@ linux_sys_ptrace_arch(l, v, retval) /* * (4) it's not currently stopped. */ - if (t->p_stat != SSTOP || !ISSET(t->p_flag, P_WAITED)) + if (t->p_stat != SSTOP || !t->p_waited /* XXXSMP */) return EBUSY; /* XXX NJWLWP diff --git a/sys/compat/linux/arch/i386/linux_syscalls.c b/sys/compat/linux/arch/i386/linux_syscalls.c index 6e861b29133..c5d90b865b3 100644 --- a/sys/compat/linux/arch/i386/linux_syscalls.c +++ b/sys/compat/linux/arch/i386/linux_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_syscalls.c,v 1.66 2006/09/01 21:19:45 matt Exp $ */ +/* $NetBSD: linux_syscalls.c,v 1.67 2007/02/09 21:55:18 ad Exp $ */ /* * System call names. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.66 2006/09/01 21:19:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.67 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT) @@ -19,7 +19,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.66 2006/09/01 21:19:45 matt Exp #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_mmap.h> diff --git a/sys/compat/linux/arch/i386/linux_sysent.c b/sys/compat/linux/arch/i386/linux_sysent.c index 98818fe5d86..3bf75aa88b0 100644 --- a/sys/compat/linux/arch/i386/linux_sysent.c +++ b/sys/compat/linux/arch/i386/linux_sysent.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sysent.c,v 1.65 2006/09/01 21:19:45 matt Exp $ */ +/* $NetBSD: linux_sysent.c,v 1.66 2007/02/09 21:55:18 ad Exp $ */ /* * System call switch table. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.65 2006/09/01 21:19:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.66 2007/02/09 21:55:18 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_43.h" @@ -18,7 +18,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.65 2006/09/01 21:19:45 matt Exp $ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_mmap.h> diff --git a/sys/compat/linux/arch/i386/syscalls.master b/sys/compat/linux/arch/i386/syscalls.master index 9dcc5473991..d66b56d26ca 100644 --- a/sys/compat/linux/arch/i386/syscalls.master +++ b/sys/compat/linux/arch/i386/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.80 2006/09/01 20:58:18 matt Exp $ + $NetBSD: syscalls.master,v 1.81 2007/02/09 21:55:18 ad Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -42,7 +42,6 @@ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/arch/m68k/linux_machdep.c b/sys/compat/linux/arch/m68k/linux_machdep.c index 842b78c5649..94a59af44b0 100644 --- a/sys/compat/linux/arch/m68k/linux_machdep.c +++ b/sys/compat/linux/arch/m68k/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.29 2007/01/04 18:27:36 elad Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.30 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.29 2007/01/04 18:27:36 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.30 2007/02/09 21:55:19 ad Exp $"); #define COMPAT_LINUX 1 @@ -50,7 +50,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.29 2007/01/04 18:27:36 elad Exp #include <sys/mount.h> #include <sys/signal.h> #include <sys/signalvar.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <sys/kauth.h> @@ -119,6 +118,7 @@ setup_linux_sigframe(frame, sig, mask, usp) struct proc *p = l->l_proc; struct linux_sigframe *fp, kf; short ft; + int error; ft = frame->f_format; @@ -234,8 +234,13 @@ setup_linux_sigframe(frame, sig, mask, usp) kf.sf_c.c_sc.sc_sp = frame->f_regs[SP]; kf.sf_c.c_sc.sc_pc = frame->f_pc; kf.sf_c.c_sc.sc_ps = frame->f_sr; + sendsig_reset(l, sig); + + mutex_exit(&p->p_smutex); + error = copyout(&kf, fp, sizeof(struct linux_sigframe)); + mutex_enter(&p->p_smutex); - if (copyout(&kf, fp, sizeof(struct linux_sigframe))) { + if (error) { #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) printf("setup_linux_sigframe(%d): copyout failed on sig %d\n", @@ -279,6 +284,7 @@ setup_linux_rt_sigframe(frame, sig, mask, usp, l) { struct proc *p = l->l_proc; struct linux_rt_sigframe *fp, kf; + int error; short ft; ft = frame->f_format; @@ -410,13 +416,18 @@ setup_linux_rt_sigframe(frame, sig, mask, usp, l) /* Build the signal context to be used by sigreturn. */ native_to_linux_sigset(&kf.sf_uc.uc_sigmask, mask); - kf.sf_uc.uc_stack.ss_sp = p->p_sigctx.ps_sigstk.ss_sp; + kf.sf_uc.uc_stack.ss_sp = l->l_sigstk.ss_sp; kf.sf_uc.uc_stack.ss_flags = - (p->p_sigctx.ps_sigstk.ss_flags & SS_ONSTACK ? LINUX_SS_ONSTACK : 0) | - (p->p_sigctx.ps_sigstk.ss_flags & SS_DISABLE ? LINUX_SS_DISABLE : 0); - kf.sf_uc.uc_stack.ss_size = p->p_sigctx.ps_sigstk.ss_size; + (l->l_sigstk.ss_flags & SS_ONSTACK ? LINUX_SS_ONSTACK : 0) | + (l->l_sigstk.ss_flags & SS_DISABLE ? LINUX_SS_DISABLE : 0); + kf.sf_uc.uc_stack.ss_size = l->l_sigstk.ss_size; + sendsig_reset(l, sig); - if (copyout(&kf, fp, sizeof(struct linux_rt_sigframe))) { + mutex_exit(&p->p_smutex); + error = copyout(&kf, fp, sizeof(struct linux_rt_sigframe)); + mutex_enter(&p->p_smutex); + + if (error) { #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) printf("setup_linux_rt_sigframe(%d): copyout failed on sig %d\n", @@ -475,7 +486,7 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) /* Remember that we're now on the signal stack. */ if (onstack) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + l->l_sigstk.ss_flags |= SS_ONSTACK; #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) @@ -530,8 +541,11 @@ linux_sys_sigreturn(l, v, retval) #endif /* Grab whole of the sigcontext. */ - if (copyin((caddr_t) usp, &tsigc2, sizeof tsigc2)) -bad: sigexit(l, SIGSEGV); + if (copyin((caddr_t) usp, &tsigc2, sizeof tsigc2)) { +bad: + mutex_enter(&p->p_smutex); + sigexit(l, SIGSEGV); + } scp = &tsigc2.c_sc; @@ -557,8 +571,10 @@ bad: sigexit(l, SIGSEGV); sz, frame->f_stackadj); #endif + mutex_enter(&p->p_smutex); + /* Restore signal stack. */ - p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK; + l->l_sigstk.ss_flags &= ~SS_ONSTACK; /* Restore signal mask. */ #if LINUX__NSIG_WORDS > 1 @@ -567,7 +583,9 @@ bad: sigexit(l, SIGSEGV); #else linux_old_to_native_sigset(&scp->sc_mask, &mask); #endif - (void) sigprocmask1(p, SIG_SETMASK, &mask, 0); + (void) sigprocmask1(l, SIG_SETMASK, &mask, 0); + + mutex_exit(&p->p_smutex); /* * Restore the user supplied information. @@ -681,8 +699,11 @@ linux_sys_rt_sigreturn(l, v, retval) #endif /* Grab whole of the ucontext. */ - if (copyin(ucp, &tuc, sizeof tuc)) -bad: sigexit(l, SIGSEGV); + if (copyin(ucp, &tuc, sizeof tuc)) { +bad: + mutex_enter(&p->p_smutex); + sigexit(l, SIGSEGV); + } /* * Check kernel stack and re-enter to syscall() if needed. @@ -709,14 +730,18 @@ bad: sigexit(l, SIGSEGV); if (tuc.uc_mc.mc_version != LINUX_MCONTEXT_VERSION) goto bad; + mutex_enter(&p->p_smutex); + /* Restore signal stack. */ - p->p_sigctx.ps_sigstk.ss_flags = - (p->p_sigctx.ps_sigstk.ss_flags & ~SS_ONSTACK) | + l->l_sigstk.ss_flags = + (l->l_sigstk.ss_flags & ~SS_ONSTACK) | (tuc.uc_stack.ss_flags & LINUX_SS_ONSTACK ? SS_ONSTACK : 0); /* Restore signal mask. */ linux_to_native_sigset(&mask, &tuc.uc_sigmask); - (void) sigprocmask1(p, SIG_SETMASK, &mask, 0); + (void) sigprocmask1(l, SIG_SETMASK, &mask, 0); + + mutex_exit(&p->p_smutex); /* * Restore the user supplied information. diff --git a/sys/compat/linux/arch/m68k/linux_syscalls.c b/sys/compat/linux/arch/m68k/linux_syscalls.c index 2ea06693303..ac9750b612c 100644 --- a/sys/compat/linux/arch/m68k/linux_syscalls.c +++ b/sys/compat/linux/arch/m68k/linux_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_syscalls.c,v 1.58 2006/09/01 21:19:45 matt Exp $ */ +/* $NetBSD: linux_syscalls.c,v 1.59 2007/02/09 21:55:19 ad Exp $ */ /* * System call names. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.58 2006/09/01 21:19:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.59 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT) @@ -20,7 +20,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.58 2006/09/01 21:19:45 matt Exp #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_signal.h> diff --git a/sys/compat/linux/arch/m68k/linux_sysent.c b/sys/compat/linux/arch/m68k/linux_sysent.c index d5b279e39d1..214d9d783df 100644 --- a/sys/compat/linux/arch/m68k/linux_sysent.c +++ b/sys/compat/linux/arch/m68k/linux_sysent.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sysent.c,v 1.58 2006/09/01 21:19:45 matt Exp $ */ +/* $NetBSD: linux_sysent.c,v 1.59 2007/02/09 21:55:19 ad Exp $ */ /* * System call switch table. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.58 2006/09/01 21:19:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.59 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -19,7 +19,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.58 2006/09/01 21:19:45 matt Exp $ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_signal.h> diff --git a/sys/compat/linux/arch/m68k/syscalls.master b/sys/compat/linux/arch/m68k/syscalls.master index 5ae1182403a..c3ecd58e3ab 100644 --- a/sys/compat/linux/arch/m68k/syscalls.master +++ b/sys/compat/linux/arch/m68k/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.52 2006/09/01 20:58:18 matt Exp $ + $NetBSD: syscalls.master,v 1.53 2007/02/09 21:55:19 ad Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -43,7 +43,6 @@ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/arch/mips/linux_machdep.c b/sys/compat/linux/arch/mips/linux_machdep.c index 3cf47327cce..33667839e10 100644 --- a/sys/compat/linux/arch/mips/linux_machdep.c +++ b/sys/compat/linux/arch/mips/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.28 2007/01/04 18:27:36 elad Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.29 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.28 2007/01/04 18:27:36 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.29 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -57,7 +57,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.28 2007/01/04 18:27:36 elad Exp #include <sys/mount.h> #include <sys/vnode.h> #include <sys/device.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <sys/filedesc.h> #include <sys/exec_elf.h> @@ -131,7 +130,7 @@ linux_sendsig(ksi, mask) struct proc *p = l->l_proc; struct linux_sigframe *fp; struct frame *f; - int i,onstack; + int i, onstack, error; sig_t catcher = SIGACTION(p, sig).sa_handler; struct linux_sigframe sf; @@ -144,7 +143,7 @@ linux_sendsig(ksi, mask) * Do we need to jump onto the signal stack? */ onstack = - (p->p_sigctx.ps_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && + (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0; /* @@ -158,8 +157,8 @@ linux_sendsig(ksi, mask) */ if (onstack) fp = (struct linux_sigframe *) - ((caddr_t)p->p_sigctx.ps_sigstk.ss_sp - + p->p_sigctx.ps_sigstk.ss_size); + ((caddr_t)l->l_sigstk.ss_sp + + l->l_sigstk.ss_size); else /* cast for _MIPS_BSD_API == _MIPS_BSD_API_LP32_64CLEAN case */ fp = (struct linux_sigframe *)(u_int32_t)f->f_regs[_R_SP]; @@ -186,17 +185,22 @@ linux_sendsig(ksi, mask) sf.lsf_sc.lsc_status = f->f_regs[_R_SR]; sf.lsf_sc.lsc_cause = f->f_regs[_R_CAUSE]; sf.lsf_sc.lsc_badvaddr = f->f_regs[_R_BADVADDR]; + sendsig_reset(l, sig); /* * Save signal stack. XXX broken */ - /* kregs.sc_onstack = p->p_sigctx.ps_sigstk.ss_flags & SS_ONSTACK; */ + /* kregs.sc_onstack = l->l_sigstk.ss_flags & SS_ONSTACK; */ /* * Install the sigframe onto the stack */ fp -= sizeof(struct linux_sigframe); - if (copyout(&sf, fp, sizeof(sf)) != 0) { + mutex_exit(&p->p_smutex); + error = copyout(&sf, fp, sizeof(sf); + mutex_enter(&p->p_smutex); + + if (error != 0) { /* * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. @@ -225,7 +229,7 @@ linux_sendsig(ksi, mask) /* Remember that we're now on the signal stack. */ if (onstack) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + l->l_sigstk.ss_flags |= SS_ONSTACK; return; } @@ -274,12 +278,16 @@ linux_sys_sigreturn(l, v, retval) f->f_regs[_R_BADVADDR] = ksf.lsf_sc.lsc_badvaddr; f->f_regs[_R_CAUSE] = ksf.lsf_sc.lsc_cause; + mutex_enter(&p->p_smutex); + /* Restore signal stack. */ - p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK; + l->l_sigstk.ss_flags &= ~SS_ONSTACK; /* Restore signal mask. */ linux_to_native_sigset(&mask, (linux_sigset_t *)&ksf.lsf_mask); - (void)sigprocmask1(p, SIG_SETMASK, &mask, 0); + (void)sigprocmask1(l, SIG_SETMASK, &mask, 0); + + mutex_exit(&p->p_smutex); return (EJUSTRETURN); } diff --git a/sys/compat/linux/arch/mips/linux_ptrace.c b/sys/compat/linux/arch/mips/linux_ptrace.c index d08429eff12..0c6186a8733 100644 --- a/sys/compat/linux/arch/mips/linux_ptrace.c +++ b/sys/compat/linux/arch/mips/linux_ptrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ptrace.c,v 1.5 2006/08/30 11:14:39 matt Exp $ */ +/* $NetBSD: linux_ptrace.c,v 1.6 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.5 2006/08/30 11:14:39 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.6 2007/02/09 21:55:19 ad Exp $"); #include "opt_ptrace.h" #include <sys/param.h> @@ -46,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.5 2006/08/30 11:14:39 matt Exp $" #include <sys/proc.h> #include <sys/ptrace.h> #include <sys/systm.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <uvm/uvm_extern.h> diff --git a/sys/compat/linux/arch/mips/linux_syscalls.c b/sys/compat/linux/arch/mips/linux_syscalls.c index b4749d77767..34650c175c4 100644 --- a/sys/compat/linux/arch/mips/linux_syscalls.c +++ b/sys/compat/linux/arch/mips/linux_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_syscalls.c,v 1.25 2006/06/10 21:16:50 christos Exp $ */ +/* $NetBSD: linux_syscalls.c,v 1.26 2007/02/09 21:55:19 ad Exp $ */ /* * System call names. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.25 2006/06/10 21:16:50 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.26 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT) @@ -20,7 +20,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.25 2006/06/10 21:16:50 christos #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_signal.h> diff --git a/sys/compat/linux/arch/mips/linux_sysent.c b/sys/compat/linux/arch/mips/linux_sysent.c index 4bb144b59db..fd45895b0f4 100644 --- a/sys/compat/linux/arch/mips/linux_sysent.c +++ b/sys/compat/linux/arch/mips/linux_sysent.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sysent.c,v 1.25 2006/06/10 21:16:50 christos Exp $ */ +/* $NetBSD: linux_sysent.c,v 1.26 2007/02/09 21:55:19 ad Exp $ */ /* * System call switch table. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.25 2006/06/10 21:16:50 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.26 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -19,7 +19,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.25 2006/06/10 21:16:50 christos E #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_signal.h> diff --git a/sys/compat/linux/arch/mips/syscalls.master b/sys/compat/linux/arch/mips/syscalls.master index 9a5020cde0b..a70ba5441fa 100644 --- a/sys/compat/linux/arch/mips/syscalls.master +++ b/sys/compat/linux/arch/mips/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.21 2006/06/10 21:15:33 christos Exp $ + $NetBSD: syscalls.master,v 1.22 2007/02/09 21:55:19 ad Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -50,7 +50,6 @@ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/arch/powerpc/linux_machdep.c b/sys/compat/linux/arch/powerpc/linux_machdep.c index 95a7b2f1f20..5bdd2ee8eb0 100644 --- a/sys/compat/linux/arch/powerpc/linux_machdep.c +++ b/sys/compat/linux/arch/powerpc/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.31 2005/12/11 12:20:16 christos Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.32 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.31 2005/12/11 12:20:16 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.32 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -57,7 +57,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.31 2005/12/11 12:20:16 christos #include <sys/mount.h> #include <sys/vnode.h> #include <sys/device.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <sys/filedesc.h> #include <sys/exec_elf.h> @@ -128,7 +127,7 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) struct linux_pt_regs linux_regs; struct linux_sigcontext sc; register_t fp; - int onstack; + int onstack, error; int i; tf = trapframe(l); @@ -137,7 +136,7 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) * Do we need to jump onto the signal stack? */ onstack = - (p->p_sigctx.ps_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && + (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0; /* @@ -151,8 +150,8 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) */ if (onstack) { fp = (register_t) - ((caddr_t)p->p_sigctx.ps_sigstk.ss_sp + - p->p_sigctx.ps_sigstk.ss_size); + ((caddr_t)l->l_sigstk.ss_sp + + l->l_sigstk.ss_size); } else { fp = tf->fixreg[1]; } @@ -212,11 +211,16 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) * binaries. But the Linux kernel seems to do without it, and it * just skip it when building the stack frame. Hence the LINUX_ABIGAP. */ - if (copyout(&frame, (caddr_t)fp, sizeof (frame) - LINUX_ABIGAP) != 0) { + sendsig_reset(l, sig); + mutex_exit(&p->p_smutex); + error = copyout(&frame, (caddr_t)fp, sizeof (frame) - LINUX_ABIGAP); + + if (error != 0) { /* * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ + mutex_enter(&p->p_smutex); sigexit(l, SIGILL); /* NOTREACHED */ } @@ -225,7 +229,10 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) * Add a sigcontext on the stack */ fp -= sizeof(struct linux_sigcontext); - if (copyout(&sc, (caddr_t)fp, sizeof (struct linux_sigcontext)) != 0) { + error = copyout(&sc, (caddr_t)fp, sizeof (struct linux_sigcontext)); + mutex_enter(&p->p_smutex); + + if (error != 0) { /* * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. @@ -251,7 +258,7 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) * Remember that we're now on the signal stack. */ if (onstack) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + l->l_sigstk.ss_flags |= SS_ONSTACK; #ifdef DEBUG_LINUX printf("linux_sendsig: exitting. fp=0x%lx\n",(long)fp); #endif @@ -309,7 +316,6 @@ linux_sys_rt_sigreturn(l, v, retval) tf = trapframe(l); #ifdef DEBUG_LINUX - printf("linux_sys_sigreturn: trapframe=0x%lx scp=0x%lx\n", (unsigned long)tf, (unsigned long)scp); #endif @@ -333,6 +339,8 @@ linux_sys_rt_sigreturn(l, v, retval) memcpy(curpcb->pcb_fpu.fpreg, (caddr_t)&sregs.lfp_regs, sizeof(curpcb->pcb_fpu.fpreg)); + mutex_enter(&p->p_smutex); + /* * Restore signal stack. * @@ -342,15 +350,17 @@ linux_sys_rt_sigreturn(l, v, retval) * It seems to be supported in libc6... */ /* if (sc.sc_onstack & SS_ONSTACK) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + l->l_sigstk.ss_flags |= SS_ONSTACK; else */ - p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK; + l->l_sigstk.ss_flags &= ~SS_ONSTACK; /* * Grab the signal mask */ linux_to_native_sigset(&mask, &sigframe.luc.luc_sigmask); - (void) sigprocmask1(p, SIG_SETMASK, &mask, 0); + (void) sigprocmask1(l, SIG_SETMASK, &mask, 0); + + mutex_exit(&p->p_smutex); return (EJUSTRETURN); } @@ -422,6 +432,8 @@ linux_sys_sigreturn(l, v, retval) memcpy(curpcb->pcb_fpu.fpreg, (caddr_t)&sregs.lfp_regs, sizeof(curpcb->pcb_fpu.fpreg)); + mutex_enter(&p->p_smutex); + /* * Restore signal stack. * @@ -430,15 +442,17 @@ linux_sys_sigreturn(l, v, retval) */ #if 0 if (sc.sc_onstack & SS_ONSTACK) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + l->l_sigstk.ss_flags |= SS_ONSTACK; else #endif - p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK; + l->l_sigstk.ss_flags &= ~SS_ONSTACK; /* Restore signal mask. */ linux_old_extra_to_native_sigset(&mask, &context.lmask, &context._unused[3]); - (void) sigprocmask1(p, SIG_SETMASK, &mask, 0); + (void) sigprocmask1(l, SIG_SETMASK, &mask, 0); + + mutex_exit(&p->p_smutex); return (EJUSTRETURN); } diff --git a/sys/compat/linux/arch/powerpc/linux_ptrace.c b/sys/compat/linux/arch/powerpc/linux_ptrace.c index b14dbdd6593..fb270f0793b 100644 --- a/sys/compat/linux/arch/powerpc/linux_ptrace.c +++ b/sys/compat/linux/arch/powerpc/linux_ptrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ptrace.c,v 1.13 2006/08/30 11:14:39 matt Exp $ */ +/* $NetBSD: linux_ptrace.c,v 1.14 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.13 2006/08/30 11:14:39 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.14 2007/02/09 21:55:19 ad Exp $"); #include "opt_ptrace.h" @@ -47,7 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.13 2006/08/30 11:14:39 matt Exp $ #include <sys/proc.h> #include <sys/ptrace.h> #include <sys/systm.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <uvm/uvm_extern.h> @@ -147,14 +146,14 @@ linux_sys_ptrace_arch(l, v, retval) /* XXX Check me! (From NetBSD/i386) */ * You can't do what you want to the process if: * (1) It's not being traced at all, */ - if (!ISSET(t->p_flag, P_TRACED)) + if (!ISSET(t->p_slflag, PSL_TRACED)) /* XXXSMP */ return EPERM; /* * (2) it's being traced by procfs (which has * different signal delivery semantics), */ - if (ISSET(t->p_flag, P_FSTRACE)) + if (ISSET(t->p_slflag, PSL_FSTRACE)) return EBUSY; /* @@ -166,7 +165,7 @@ linux_sys_ptrace_arch(l, v, retval) /* XXX Check me! (From NetBSD/i386) */ /* * (4) it's not currently stopped. */ - if (t->p_stat != SSTOP || !ISSET(t->p_flag, P_WAITED)) + if (t->p_stat != SSTOP || !t->p_waited) return EBUSY; lt = LIST_FIRST(&t->p_lwps); diff --git a/sys/compat/linux/arch/powerpc/linux_syscalls.c b/sys/compat/linux/arch/powerpc/linux_syscalls.c index 8302be318bf..e4acd430127 100644 --- a/sys/compat/linux/arch/powerpc/linux_syscalls.c +++ b/sys/compat/linux/arch/powerpc/linux_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_syscalls.c,v 1.34 2006/09/01 21:19:45 matt Exp $ */ +/* $NetBSD: linux_syscalls.c,v 1.35 2007/02/09 21:55:19 ad Exp $ */ /* * System call names. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.34 2006/09/01 21:19:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.35 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT) @@ -20,7 +20,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscalls.c,v 1.34 2006/09/01 21:19:45 matt Exp #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_signal.h> diff --git a/sys/compat/linux/arch/powerpc/linux_sysent.c b/sys/compat/linux/arch/powerpc/linux_sysent.c index 4a2ab6a28c2..4babbf0d6af 100644 --- a/sys/compat/linux/arch/powerpc/linux_sysent.c +++ b/sys/compat/linux/arch/powerpc/linux_sysent.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sysent.c,v 1.35 2006/09/01 21:19:45 matt Exp $ */ +/* $NetBSD: linux_sysent.c,v 1.36 2007/02/09 21:55:19 ad Exp $ */ /* * System call switch table. @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.35 2006/09/01 21:19:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.36 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -19,7 +19,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sysent.c,v 1.35 2006/09/01 21:19:45 matt Exp $ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_signal.h> diff --git a/sys/compat/linux/arch/powerpc/syscalls.master b/sys/compat/linux/arch/powerpc/syscalls.master index 0844e41bd10..26d6a451226 100644 --- a/sys/compat/linux/arch/powerpc/syscalls.master +++ b/sys/compat/linux/arch/powerpc/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.29 2006/09/01 20:58:18 matt Exp $ + $NetBSD: syscalls.master,v 1.30 2007/02/09 21:55:19 ad Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -72,7 +72,6 @@ #include <sys/systm.h> #include <sys/signal.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_blkio.c b/sys/compat/linux/common/linux_blkio.c index 378b2dca52e..3cc4267f317 100644 --- a/sys/compat/linux/common/linux_blkio.c +++ b/sys/compat/linux/common/linux_blkio.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_blkio.c,v 1.12 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_blkio.c,v 1.13 2007/02/09 21:55:19 ad Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_blkio.c,v 1.12 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_blkio.c,v 1.13 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,7 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_blkio.c,v 1.12 2006/11/16 01:32:42 christos Ex #include <sys/proc.h> #include <sys/disklabel.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_break.c b/sys/compat/linux/common/linux_break.c index 32d19e17b71..8af653d8109 100644 --- a/sys/compat/linux/common/linux_break.c +++ b/sys/compat/linux/common/linux_break.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_break.c,v 1.53 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_break.c,v 1.54 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,13 +37,12 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_break.c,v 1.53 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_break.c,v 1.54 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_cdrom.c b/sys/compat/linux/common/linux_cdrom.c index 0dca185d998..1ed44cedfb4 100644 --- a/sys/compat/linux/common/linux_cdrom.c +++ b/sys/compat/linux/common/linux_cdrom.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_cdrom.c,v 1.20 2006/06/12 00:42:18 christos Exp $ */ +/* $NetBSD: linux_cdrom.c,v 1.21 2007/02/09 21:55:19 ad Exp $ */ /* * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_cdrom.c,v 1.20 2006/06/12 00:42:18 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_cdrom.c,v 1.21 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,7 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_cdrom.c,v 1.20 2006/06/12 00:42:18 christos Ex #include <sys/dvdio.h> #include <sys/malloc.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_exec.c b/sys/compat/linux/common/linux_exec.c index d3821c2bb60..655fe4dc891 100644 --- a/sys/compat/linux/common/linux_exec.c +++ b/sys/compat/linux/common/linux_exec.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_exec.c,v 1.89 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_exec.c,v 1.90 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1994, 1995, 1998, 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_exec.c,v 1.89 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_exec.c,v 1.90 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -52,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_exec.c,v 1.89 2006/11/16 01:32:42 christos Exp #include <sys/exec_elf.h> #include <sys/mman.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <sys/ptrace.h> /* For proc_reparent() */ @@ -158,7 +157,7 @@ const struct emul emul_linux = { uvm_default_mapaddr, linux_usertrap, - NULL, + 0, }; static void diff --git a/sys/compat/linux/common/linux_exec.h b/sys/compat/linux/common/linux_exec.h index 61305942fd1..83722ca63c1 100644 --- a/sys/compat/linux/common/linux_exec.h +++ b/sys/compat/linux/common/linux_exec.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_exec.h,v 1.39 2006/08/23 19:49:09 manu Exp $ */ +/* $NetBSD: linux_exec.h,v 1.40 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -135,7 +135,7 @@ void linux_setregs __P((struct lwp *, struct exec_package *, u_long)); int exec_linux_aout_makecmds __P((struct lwp *, struct exec_package *)); int linux_aout_copyargs __P((struct lwp *, struct exec_package *, struct ps_strings *, char **, void *)); -void linux_trapsignal __P((struct lwp *, const ksiginfo_t *)); +void linux_trapsignal __P((struct lwp *, ksiginfo_t *)); int linux_usertrap __P((struct lwp *, vaddr_t, void *)); #ifdef LINUX_NPTL void linux_nptl_proc_fork __P((struct proc *, struct proc *, diff --git a/sys/compat/linux/common/linux_exec_aout.c b/sys/compat/linux/common/linux_exec_aout.c index 7bfca48af78..afa84451778 100644 --- a/sys/compat/linux/common/linux_exec_aout.c +++ b/sys/compat/linux/common/linux_exec_aout.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_exec_aout.c,v 1.60 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_exec_aout.c,v 1.61 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.60 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.61 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -55,7 +55,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.60 2006/11/16 01:32:42 christo #include <sys/exec_elf.h> #include <sys/mman.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <machine/cpu.h> diff --git a/sys/compat/linux/common/linux_exec_elf32.c b/sys/compat/linux/common/linux_exec_elf32.c index 48c3550ddd4..82efe4e63db 100644 --- a/sys/compat/linux/common/linux_exec_elf32.c +++ b/sys/compat/linux/common/linux_exec_elf32.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_exec_elf32.c,v 1.76 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_exec_elf32.c,v 1.77 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998, 2000, 2001 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.76 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.77 2007/02/09 21:55:19 ad Exp $"); #ifndef ELFSIZE /* XXX should die */ @@ -63,7 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.76 2006/11/16 01:32:42 christ #include <sys/kauth.h> #include <sys/mman.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <machine/cpu.h> diff --git a/sys/compat/linux/common/linux_fdio.c b/sys/compat/linux/common/linux_fdio.c index 12161b92eed..778abfbe823 100644 --- a/sys/compat/linux/common/linux_fdio.c +++ b/sys/compat/linux/common/linux_fdio.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_fdio.c,v 1.8 2005/12/11 12:20:19 christos Exp $ */ +/* $NetBSD: linux_fdio.c,v 1.9 2007/02/09 21:55:19 ad Exp $ */ /* * Copyright (c) 2000 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_fdio.c,v 1.8 2005/12/11 12:20:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_fdio.c,v 1.9 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -49,7 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_fdio.c,v 1.8 2005/12/11 12:20:19 christos Exp #include <sys/fdio.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <dev/isa/fdreg.h> diff --git a/sys/compat/linux/common/linux_file.c b/sys/compat/linux/common/linux_file.c index 8acfa18bb3f..778ce492507 100644 --- a/sys/compat/linux/common/linux_file.c +++ b/sys/compat/linux/common/linux_file.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_file.c,v 1.76 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_file.c,v 1.77 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.76 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.77 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -61,7 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.76 2006/11/16 01:32:42 christos Exp #include <sys/conf.h> #include <sys/pipe.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> @@ -209,7 +208,7 @@ linux_sys_open(l, v, retval) * terminal yet, and the O_NOCTTY flag is not set, try to make * this the controlling terminal. */ - if (!(fl & O_NOCTTY) && SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) { + if (!(fl & O_NOCTTY) && SESS_LEADER(p) && !(p->p_lflag & PL_CONTROLT)) { struct filedesc *fdp = p->p_fd; struct file *fp; diff --git a/sys/compat/linux/common/linux_file64.c b/sys/compat/linux/common/linux_file64.c index cb6e173daf9..319f5709483 100644 --- a/sys/compat/linux/common/linux_file64.c +++ b/sys/compat/linux/common/linux_file64.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_file64.c,v 1.34 2006/07/23 22:06:09 ad Exp $ */ +/* $NetBSD: linux_file64.c,v 1.35 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998, 2000 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.34 2006/07/23 22:06:09 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.35 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -59,7 +59,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.34 2006/07/23 22:06:09 ad Exp $") #include <sys/tty.h> #include <sys/conf.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_hdio.c b/sys/compat/linux/common/linux_hdio.c index 157714b9ca9..04968aedba6 100644 --- a/sys/compat/linux/common/linux_hdio.c +++ b/sys/compat/linux/common/linux_hdio.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_hdio.c,v 1.10 2005/12/11 12:20:19 christos Exp $ */ +/* $NetBSD: linux_hdio.c,v 1.11 2007/02/09 21:55:19 ad Exp $ */ /* * Copyright (c) 2000 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.10 2005/12/11 12:20:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.11 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -51,7 +51,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.10 2005/12/11 12:20:19 christos Exp #include <dev/ic/wdcreg.h> #include <sys/ataio.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_ioctl.c b/sys/compat/linux/common/linux_ioctl.c index 15265618fa5..33264ff9485 100644 --- a/sys/compat/linux/common/linux_ioctl.c +++ b/sys/compat/linux/common/linux_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ioctl.c,v 1.45 2006/07/23 22:06:09 ad Exp $ */ +/* $NetBSD: linux_ioctl.c,v 1.46 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.45 2006/07/23 22:06:09 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.46 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #include "sequencer.h" @@ -57,7 +57,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.45 2006/07/23 22:06:09 ad Exp $"); #include <net/if.h> #include <sys/sockio.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_ipc.c b/sys/compat/linux/common/linux_ipc.c index 18311e7b6b7..7abcbb3cc33 100644 --- a/sys/compat/linux/common/linux_ipc.c +++ b/sys/compat/linux/common/linux_ipc.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ipc.c,v 1.37 2006/09/13 19:55:49 manu Exp $ */ +/* $NetBSD: linux_ipc.c,v 1.38 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.37 2006/09/13 19:55:49 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.38 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" @@ -51,7 +51,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.37 2006/09/13 19:55:49 manu Exp $"); #include <sys/systm.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_ipccall.c b/sys/compat/linux/common/linux_ipccall.c index 6fc821f1908..3a8297f6bf6 100644 --- a/sys/compat/linux/common/linux_ipccall.c +++ b/sys/compat/linux/common/linux_ipccall.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ipccall.c,v 1.26 2005/12/11 12:20:19 christos Exp $ */ +/* $NetBSD: linux_ipccall.c,v 1.27 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_ipccall.c,v 1.26 2005/12/11 12:20:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_ipccall.c,v 1.27 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" @@ -52,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ipccall.c,v 1.26 2005/12/11 12:20:19 christos /* real syscalls */ #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> /* sys_ipc + args prototype */ diff --git a/sys/compat/linux/common/linux_llseek.c b/sys/compat/linux/common/linux_llseek.c index 5d6d27b6fae..d27850df0be 100644 --- a/sys/compat/linux/common/linux_llseek.c +++ b/sys/compat/linux/common/linux_llseek.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_llseek.c,v 1.27 2003/01/18 08:02:53 thorpej Exp $ */ +/* $NetBSD: linux_llseek.c,v 1.28 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_llseek.c,v 1.27 2003/01/18 08:02:53 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_llseek.c,v 1.28 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -46,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_llseek.c,v 1.27 2003/01/18 08:02:53 thorpej Ex #include <sys/malloc.h> #include <sys/conf.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c index a2ed00cffed..5564426d558 100644 --- a/sys/compat/linux/common/linux_misc.c +++ b/sys/compat/linux/common/linux_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc.c,v 1.165 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_misc.c,v 1.166 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.165 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.166 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_ptrace.h" @@ -104,7 +104,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.165 2006/11/16 01:32:42 christos Ex #include <sys/ptrace.h> #include <machine/ptrace.h> -#include <sys/sa.h> #include <sys/syscall.h> #include <sys/syscallargs.h> @@ -269,7 +268,7 @@ linux_sys_wait4(l, v, retval) if ((error = sys_wait4(l, &w4a, retval))) return error; - sigdelset(&p->p_sigctx.ps_siglist, SIGCHLD); + sigdelset(&p->p_sigpend.sp_set, SIGCHLD); /* XXXAD ksiginfo leak */ if (status != NULL) { if ((error = copyin(status, &tstat, sizeof tstat))) @@ -781,12 +780,13 @@ linux_sys_times(l, v, retval) struct linux_tms ltms; struct rusage ru; - calcru(p, &ru.ru_utime, &ru.ru_stime, NULL); + mutex_enter(&p->p_smutex); + calcru(p, &ru.ru_utime, &ru.ru_stime, NULL, NULL); ltms.ltms_utime = CONVTCK(ru.ru_utime); ltms.ltms_stime = CONVTCK(ru.ru_stime); - ltms.ltms_cutime = CONVTCK(p->p_stats->p_cru.ru_utime); ltms.ltms_cstime = CONVTCK(p->p_stats->p_cru.ru_stime); + mutex_exit(&p->p_smutex); if ((error = copyout(<ms, SCARG(uap, tms), sizeof ltms))) return error; diff --git a/sys/compat/linux/common/linux_misc_notalpha.c b/sys/compat/linux/common/linux_misc_notalpha.c index ecda951f068..330a81a9d10 100644 --- a/sys/compat/linux/common/linux_misc_notalpha.c +++ b/sys/compat/linux/common/linux_misc_notalpha.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc_notalpha.c,v 1.84 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_misc_notalpha.c,v 1.85 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.84 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.85 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -56,7 +56,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.84 2006/11/16 01:32:42 chr #include <sys/wait.h> #include <sys/kauth.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_mtio.c b/sys/compat/linux/common/linux_mtio.c index 82ce93458b9..a11e9e0895f 100644 --- a/sys/compat/linux/common/linux_mtio.c +++ b/sys/compat/linux/common/linux_mtio.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_mtio.c,v 1.2 2005/12/11 12:20:19 christos Exp $ */ +/* $NetBSD: linux_mtio.c,v 1.3 2007/02/09 21:55:19 ad Exp $ */ /* * Copyright (c) 2005 Soren S. Jorvang. All rights reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_mtio.c,v 1.2 2005/12/11 12:20:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_mtio.c,v 1.3 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -38,7 +38,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_mtio.c,v 1.2 2005/12/11 12:20:19 christos Exp #include <sys/mtio.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_oldmmap.c b/sys/compat/linux/common/linux_oldmmap.c index 4f0c953a021..a9eb810bc47 100644 --- a/sys/compat/linux/common/linux_oldmmap.c +++ b/sys/compat/linux/common/linux_oldmmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_oldmmap.c,v 1.65 2006/02/09 19:18:56 manu Exp $ */ +/* $NetBSD: linux_oldmmap.c,v 1.66 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,13 +37,12 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_oldmmap.c,v 1.65 2006/02/09 19:18:56 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_oldmmap.c,v 1.66 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <uvm/uvm_param.h> diff --git a/sys/compat/linux/common/linux_oldolduname.c b/sys/compat/linux/common/linux_oldolduname.c index e3824500332..b6ceac2653c 100644 --- a/sys/compat/linux/common/linux_oldolduname.c +++ b/sys/compat/linux/common/linux_oldolduname.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_oldolduname.c,v 1.60 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_oldolduname.c,v 1.61 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,14 +37,13 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_oldolduname.c,v 1.60 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_oldolduname.c,v 1.61 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_oldselect.c b/sys/compat/linux/common/linux_oldselect.c index 1cb09931e07..fe3655c125e 100644 --- a/sys/compat/linux/common/linux_oldselect.c +++ b/sys/compat/linux/common/linux_oldselect.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_oldselect.c,v 1.53 2003/01/18 08:04:38 thorpej Exp $ */ +/* $NetBSD: linux_oldselect.c,v 1.54 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,13 +37,12 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_oldselect.c,v 1.53 2003/01/18 08:04:38 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_oldselect.c,v 1.54 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_olduname.c b/sys/compat/linux/common/linux_olduname.c index b3ad5b1cbab..b0bff614ca2 100644 --- a/sys/compat/linux/common/linux_olduname.c +++ b/sys/compat/linux/common/linux_olduname.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_olduname.c,v 1.60 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_olduname.c,v 1.61 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.60 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.61 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -46,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.60 2006/11/16 01:32:42 christos #include <sys/mman.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_pipe.c b/sys/compat/linux/common/linux_pipe.c index bd188ed02be..2ba4eee585c 100644 --- a/sys/compat/linux/common/linux_pipe.c +++ b/sys/compat/linux/common/linux_pipe.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_pipe.c,v 1.57 2005/12/11 12:20:19 christos Exp $ */ +/* $NetBSD: linux_pipe.c,v 1.58 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.57 2005/12/11 12:20:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.58 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,7 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.57 2005/12/11 12:20:19 christos Exp #include <sys/mman.h> #include <sys/mount.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_sched.c b/sys/compat/linux/common/linux_sched.c index f5d0879fc7b..a0afcab2d68 100644 --- a/sys/compat/linux/common/linux_sched.c +++ b/sys/compat/linux/common/linux_sched.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sched.c,v 1.39 2007/02/05 18:31:36 njoly Exp $ */ +/* $NetBSD: linux_sched.c,v 1.40 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.39 2007/02/05 18:31:36 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.40 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/mount.h> @@ -50,7 +50,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.39 2007/02/05 18:31:36 njoly Exp $ #include <sys/systm.h> #include <sys/sysctl.h> #include <sys/malloc.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <sys/wait.h> #include <sys/kauth.h> diff --git a/sys/compat/linux/common/linux_sg.c b/sys/compat/linux/common/linux_sg.c index 55a961fbfc6..37042783990 100644 --- a/sys/compat/linux/common/linux_sg.c +++ b/sys/compat/linux/common/linux_sg.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sg.c,v 1.8 2006/09/13 00:51:12 christos Exp $ */ +/* $NetBSD: linux_sg.c,v 1.9 2007/02/09 21:55:19 ad Exp $ */ /* * Copyright (c) 2004 Soren S. Jorvang. All rights reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sg.c,v 1.8 2006/09/13 00:51:12 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sg.c,v 1.9 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -41,7 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sg.c,v 1.8 2006/09/13 00:51:12 christos Exp $" #include <dev/scsipi/scsipi_all.h> #include <dev/scsipi/scsiconf.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_sig_notalpha.c b/sys/compat/linux/common/linux_sig_notalpha.c index 73d9bc19bb9..d2624cadf10 100644 --- a/sys/compat/linux/common/linux_sig_notalpha.c +++ b/sys/compat/linux/common/linux_sig_notalpha.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sig_notalpha.c,v 1.32 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_sig_notalpha.c,v 1.33 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sig_notalpha.c,v 1.32 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sig_notalpha.c,v 1.33 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -52,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sig_notalpha.c,v 1.32 2006/11/16 01:32:42 chri #include <sys/signal.h> #include <sys/signalvar.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> @@ -81,7 +80,6 @@ linux_sys_signal(l, v, retval) syscallarg(int) signum; syscallarg(linux_handler_t) handler; } */ *uap = v; - struct proc *p = l->l_proc; struct sigaction nbsa, obsa; int error, sig; @@ -93,7 +91,7 @@ linux_sys_signal(l, v, retval) nbsa.sa_handler = SCARG(uap, handler); sigemptyset(&nbsa.sa_mask); nbsa.sa_flags = SA_RESETHAND | SA_NODEFER; - error = sigaction1(p, linux_to_native_signo[sig], + error = sigaction1(l, linux_to_native_signo[sig], &nbsa, &obsa, NULL, 0); if (error == 0) *retval = (int)(long)obsa.sa_handler; /* XXXmanu cast */ @@ -111,7 +109,9 @@ linux_sys_siggetmask(struct lwp *l, void *v, linux_old_sigset_t lss; int error; - error = sigprocmask1(p, SIG_SETMASK, 0, &bss); + mutex_enter(&p->p_smutex); + error = sigprocmask1(l, SIG_SETMASK, 0, &bss); + mutex_exit(&p->p_smutex); if (error) return (error); native_to_linux_old_sigset(&lss, &bss); @@ -133,14 +133,16 @@ linux_sys_sigsetmask(l, v, retval) struct linux_sys_sigsetmask_args /* { syscallarg(linux_old_sigset_t) mask; } */ *uap = v; - struct proc *p = l->l_proc; sigset_t nbss, obss; linux_old_sigset_t nlss, olss; + struct proc *p = l->l_proc; int error; nlss = SCARG(uap, mask); linux_old_to_native_sigset(&nbss, &nlss); - error = sigprocmask1(p, SIG_SETMASK, &nbss, &obss); + mutex_enter(&p->p_smutex); + error = sigprocmask1(l, SIG_SETMASK, &nbss, &obss); + mutex_exit(&p->p_smutex); if (error) return (error); native_to_linux_old_sigset(&olss, &obss); @@ -156,9 +158,8 @@ linux_sys_sigprocmask(struct lwp *l, void *v, register_t *retval) syscallarg(const linux_old_sigset_t *) set; syscallarg(linux_old_sigset_t *) oset; } */ *uap = v; - struct proc *p = l->l_proc; - return(linux_sigprocmask1(p, SCARG(uap, how), + return(linux_sigprocmask1(l, SCARG(uap, how), SCARG(uap, set), SCARG(uap, oset))); } #endif /* !__amd64__ */ @@ -170,8 +171,7 @@ linux_sys_sigprocmask(struct lwp *l, void *v, register_t *retval) int linux_sys_pause(struct lwp *l, void *v, register_t *retval) { - struct proc *p = l->l_proc; - return (sigsuspend1(p, 0)); + return (sigsuspend1(l, 0)); } diff --git a/sys/compat/linux/common/linux_sigaction.c b/sys/compat/linux/common/linux_sigaction.c index 33b4e15d0f3..b40c2f6f933 100644 --- a/sys/compat/linux/common/linux_sigaction.c +++ b/sys/compat/linux/common/linux_sigaction.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sigaction.c,v 1.29 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_sigaction.c,v 1.30 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sigaction.c,v 1.29 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sigaction.c,v 1.30 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -52,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sigaction.c,v 1.29 2006/11/16 01:32:42 christo #include <sys/signal.h> #include <sys/signalvar.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> @@ -77,7 +76,6 @@ linux_sys_sigaction(struct lwp *l, void *v, register_t *retval) syscallarg(const struct linux_old_sigaction *) nsa; syscallarg(struct linux_old_sigaction *) osa; } */ *uap = v; - struct proc *p = l->l_proc; struct linux_old_sigaction nlsa, olsa; struct sigaction nbsa, obsa; int error, sig; @@ -100,7 +98,7 @@ linux_sys_sigaction(struct lwp *l, void *v, register_t *retval) sigemptyset(&obsa.sa_mask); obsa.sa_flags = 0; } else { - error = sigaction1(p, linux_to_native_signo[sig], + error = sigaction1(l, linux_to_native_signo[sig], SCARG(uap, nsa) ? &nbsa : 0, SCARG(uap, osa) ? &obsa : 0, NULL, 0); if (error) diff --git a/sys/compat/linux/common/linux_signal.c b/sys/compat/linux/common/linux_signal.c index 0fb144449a0..d767cf103fb 100644 --- a/sys/compat/linux/common/linux_signal.c +++ b/sys/compat/linux/common/linux_signal.c @@ -1,4 +1,5 @@ -/* $NetBSD: linux_signal.c,v 1.52 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_signal.c,v 1.53 2007/02/09 21:55:19 ad Exp $ */ + /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -54,7 +55,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.52 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.53 2007/02/09 21:55:19 ad Exp $"); #define COMPAT_LINUX 1 @@ -70,7 +71,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.52 2006/11/16 01:32:42 christos E #include <sys/signalvar.h> #include <sys/malloc.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> @@ -288,14 +288,13 @@ linux_sys_rt_sigaction(struct lwp *l, void *v, register_t *retval) syscallarg(struct linux_sigaction *) osa; syscallarg(size_t) sigsetsize; } */ *uap = v; - struct proc *p = l->l_proc; struct linux_sigaction nlsa, olsa; struct sigaction nbsa, obsa; int error, sig; void *tramp = NULL; int vers = 0; #if defined __amd64__ - struct sigacts *ps = p->p_sigacts; + struct sigacts *ps = l->l_proc->p_sigacts; #endif if (SCARG(uap, sigsetsize) != sizeof(linux_sigset_t)) @@ -324,7 +323,7 @@ linux_sys_rt_sigaction(struct lwp *l, void *v, register_t *retval) } #endif - error = sigaction1(p, linux_to_native_signo[sig], + error = sigaction1(l, linux_to_native_signo[sig], SCARG(uap, nsa) ? &nbsa : NULL, SCARG(uap, osa) ? &obsa : NULL, tramp, vers); @@ -349,12 +348,13 @@ linux_sys_rt_sigaction(struct lwp *l, void *v, register_t *retval) } int -linux_sigprocmask1(p, how, set, oset) - struct proc *p; +linux_sigprocmask1(l, how, set, oset) + struct lwp *l; int how; const linux_old_sigset_t *set; linux_old_sigset_t *oset; { + struct proc *p = l->l_proc; linux_old_sigset_t nlss, olss; sigset_t nbss, obss; int error; @@ -379,8 +379,10 @@ linux_sigprocmask1(p, how, set, oset) return (error); linux_old_to_native_sigset(&nbss, &nlss); } - error = sigprocmask1(p, how, + mutex_enter(&p->p_smutex); + error = sigprocmask1(l, how, set ? &nbss : NULL, oset ? &obss : NULL); + mutex_exit(&p->p_smutex); if (error) return (error); if (oset) { @@ -401,9 +403,9 @@ linux_sys_rt_sigprocmask(struct lwp *l, void *v, register_t *retval) syscallarg(linux_sigset_t *) oset; syscallarg(size_t) sigsetsize; } */ *uap = v; - struct proc *p = l->l_proc; linux_sigset_t nlss, olss, *oset; const linux_sigset_t *set; + struct proc *p = l->l_proc; sigset_t nbss, obss; int error, how; @@ -433,8 +435,10 @@ linux_sys_rt_sigprocmask(struct lwp *l, void *v, register_t *retval) return (error); linux_to_native_sigset(&nbss, &nlss); } - error = sigprocmask1(p, how, + mutex_enter(&p->p_smutex); + error = sigprocmask1(l, how, set ? &nbss : NULL, oset ? &obss : NULL); + mutex_exit(&p->p_smutex); if (!error && oset) { native_to_linux_sigset(&olss, &obss); error = copyout(&olss, oset, sizeof(olss)); @@ -449,14 +453,13 @@ linux_sys_rt_sigpending(struct lwp *l, void *v, register_t *retval) syscallarg(linux_sigset_t *) set; syscallarg(size_t) sigsetsize; } */ *uap = v; - struct proc *p = l->l_proc; sigset_t bss; linux_sigset_t lss; if (SCARG(uap, sigsetsize) != sizeof(linux_sigset_t)) return (EINVAL); - sigpending1(p, &bss); + sigpending1(l, &bss); native_to_linux_sigset(&lss, &bss); return copyout(&lss, SCARG(uap, set), sizeof(lss)); } @@ -468,11 +471,10 @@ linux_sys_sigpending(struct lwp *l, void *v, register_t *retval) struct linux_sys_sigpending_args /* { syscallarg(linux_old_sigset_t *) mask; } */ *uap = v; - struct proc *p = l->l_proc; sigset_t bss; linux_old_sigset_t lss; - sigpending1(p, &bss); + sigpending1(l, &bss); native_to_linux_old_sigset(&lss, &bss); return copyout(&lss, SCARG(uap, set), sizeof(lss)); } @@ -485,13 +487,12 @@ linux_sys_sigsuspend(struct lwp *l, void *v, register_t *retval) syscallarg(int) oldmask; syscallarg(int) mask; } */ *uap = v; - struct proc *p = l->l_proc; linux_old_sigset_t lss; sigset_t bss; lss = SCARG(uap, mask); linux_old_to_native_sigset(&bss, &lss); - return (sigsuspend1(p, &bss)); + return (sigsuspend1(l, &bss)); } #endif /* __amd64__ */ @@ -502,7 +503,6 @@ linux_sys_rt_sigsuspend(struct lwp *l, void *v, register_t *retval) syscallarg(linux_sigset_t *) unewset; syscallarg(size_t) sigsetsize; } */ *uap = v; - struct proc *p = l->l_proc; linux_sigset_t lss; sigset_t bss; int error; @@ -516,7 +516,7 @@ linux_sys_rt_sigsuspend(struct lwp *l, void *v, register_t *retval) linux_to_native_sigset(&bss, &lss); - return (sigsuspend1(p, &bss)); + return (sigsuspend1(l, &bss)); } /* @@ -606,13 +606,13 @@ linux_sys_sigaltstack(struct lwp *l, void *v, register_t *retval) syscallarg(const struct linux_sigaltstack *) ss; syscallarg(struct linux_sigaltstack *) oss; } */ *uap = v; - struct proc *p = l->l_proc; struct linux_sigaltstack ss; struct sigaltstack nss; - int error; + struct proc *p = l->l_proc; + int error = 0; if (SCARG(uap, oss)) { - native_to_linux_sigaltstack(&ss, &p->p_sigctx.ps_sigstk); + native_to_linux_sigaltstack(&ss, &l->l_sigstk); if ((error = copyout(&ss, SCARG(uap, oss), sizeof(ss))) != 0) return error; } @@ -622,20 +622,23 @@ linux_sys_sigaltstack(struct lwp *l, void *v, register_t *retval) return error; linux_to_native_sigaltstack(&nss, &ss); + mutex_enter(&p->p_smutex); + if (nss.ss_flags & ~SS_ALLBITS) - return EINVAL; - - if (nss.ss_flags & SS_DISABLE) { - if (p->p_sigctx.ps_sigstk.ss_flags & SS_ONSTACK) - return EINVAL; - } else { - if (nss.ss_size < LINUX_MINSIGSTKSZ) - return ENOMEM; - } - p->p_sigctx.ps_sigstk = nss; + error = EINVAL; + else if (nss.ss_flags & SS_DISABLE) { + if (l->l_sigstk.ss_flags & SS_ONSTACK) + error = EINVAL; + } else if (nss.ss_size < LINUX_MINSIGSTKSZ) + error = ENOMEM; + + if (error == 0) + l->l_sigstk = nss; + + mutex_exit(&p->p_smutex); } - return 0; + return error; } #endif /* LINUX_SS_ONSTACK */ diff --git a/sys/compat/linux/common/linux_signal.h b/sys/compat/linux/common/linux_signal.h index 0d148545568..165bfb33bf6 100644 --- a/sys/compat/linux/common/linux_signal.h +++ b/sys/compat/linux/common/linux_signal.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_signal.h,v 1.25 2005/12/11 12:20:19 christos Exp $ */ +/* $NetBSD: linux_signal.h,v 1.26 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ extern const int native_to_linux_signo[]; extern const int linux_to_native_signo[]; __BEGIN_DECLS -int linux_sigprocmask1 __P((struct proc *, int, const linux_old_sigset_t *, +int linux_sigprocmask1 __P((struct lwp *, int, const linux_old_sigset_t *, linux_old_sigset_t *)); #if LINUX__NSIG_WORDS > 1 diff --git a/sys/compat/linux/common/linux_socket.c b/sys/compat/linux/common/linux_socket.c index 1bdbadf4292..014bbeab2de 100644 --- a/sys/compat/linux/common/linux_socket.c +++ b/sys/compat/linux/common/linux_socket.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_socket.c,v 1.68 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_socket.c,v 1.69 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.68 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.69 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -76,7 +76,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.68 2006/11/16 01:32:42 christos E #include <sys/exec.h> #include <sys/kauth.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <lib/libkern/libkern.h> diff --git a/sys/compat/linux/common/linux_socketcall.c b/sys/compat/linux/common/linux_socketcall.c index 8c0b34e0878..0a1a8990c0e 100644 --- a/sys/compat/linux/common/linux_socketcall.c +++ b/sys/compat/linux/common/linux_socketcall.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_socketcall.c,v 1.30 2005/12/11 12:20:19 christos Exp $ */ +/* $NetBSD: linux_socketcall.c,v 1.31 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.30 2005/12/11 12:20:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.31 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -59,7 +59,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.30 2005/12/11 12:20:19 christ #include <sys/vnode.h> #include <sys/device.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_sysctl.c b/sys/compat/linux/common/linux_sysctl.c index 74955b984c8..11de9241240 100644 --- a/sys/compat/linux/common/linux_sysctl.c +++ b/sys/compat/linux/common/linux_sysctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sysctl.c,v 1.24 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_sysctl.c,v 1.25 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.24 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.25 2007/02/09 21:55:19 ad Exp $"); #if defined (_KERNEL_OPT) #include "opt_ktrace.h" @@ -53,7 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.24 2006/11/16 01:32:42 christos E #include <sys/proc.h> #include <sys/mount.h> #include <sys/sysctl.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #ifdef KTRACE #include <sys/ktrace.h> diff --git a/sys/compat/linux/common/linux_termios.c b/sys/compat/linux/common/linux_termios.c index 7eb97511af8..f39c37e4537 100644 --- a/sys/compat/linux/common/linux_termios.c +++ b/sys/compat/linux/common/linux_termios.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_termios.c,v 1.27 2006/11/25 22:03:41 elad Exp $ */ +/* $NetBSD: linux_termios.c,v 1.28 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_termios.c,v 1.27 2006/11/25 22:03:41 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_termios.c,v 1.28 2007/02/09 21:55:19 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_ptm.h" @@ -52,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_termios.c,v 1.27 2006/11/25 22:03:41 elad Exp #include <sys/mount.h> #include <sys/termios.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_types.h> diff --git a/sys/compat/linux/common/linux_time.c b/sys/compat/linux/common/linux_time.c index 3fdd0fa614a..7a88e12341a 100644 --- a/sys/compat/linux/common/linux_time.c +++ b/sys/compat/linux/common/linux_time.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_time.c,v 1.14 2006/05/14 03:40:54 christos Exp $ */ +/* $NetBSD: linux_time.c,v 1.15 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.14 2006/05/14 03:40:54 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.15 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/ucred.h> @@ -46,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.14 2006/05/14 03:40:54 christos Exp #include <sys/stdint.h> #include <sys/time.h> #include <sys/systm.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <sys/lwp.h> #include <sys/proc.h> diff --git a/sys/compat/linux/common/linux_uselib.c b/sys/compat/linux/common/linux_uselib.c index db2063c1c06..837bf923001 100644 --- a/sys/compat/linux/common/linux_uselib.c +++ b/sys/compat/linux/common/linux_uselib.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_uselib.c,v 1.18 2006/11/16 01:32:42 christos Exp $ */ +/* $NetBSD: linux_uselib.c,v 1.19 2007/02/09 21:55:19 ad Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_uselib.c,v 1.18 2006/11/16 01:32:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_uselib.c,v 1.19 2007/02/09 21:55:19 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -51,7 +51,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_uselib.c,v 1.18 2006/11/16 01:32:42 christos E #include <sys/exec_elf.h> #include <sys/mman.h> -#include <sys/sa.h> #include <sys/syscallargs.h> #include <machine/cpu.h> |
