sigaction until 1.4 had an int sigmask, don't trash the stack.

This commit is contained in:
christos 2014-01-24 22:10:47 +00:00
parent 76f776f138
commit e0277e0438
2 changed files with 14 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32.h,v 1.97 2014/01/01 18:57:16 dsl Exp $ */
/* $NetBSD: netbsd32.h,v 1.98 2014/01/24 22:10:47 christos Exp $ */
/*
* Copyright (c) 1998, 2001, 2008 Matthew R. Green
@ -48,6 +48,7 @@
#include <sys/ucred.h>
#include <compat/sys/ucontext.h>
#include <compat/sys/mount.h>
#include <compat/sys/signal.h>
/*
* first, define the basic types we need.
@ -586,6 +587,12 @@ struct netbsd32_shmid_ds14 {
/* from <sys/signal.h> */
typedef netbsd32_pointer_t netbsd32_sigsetp_t;
typedef netbsd32_pointer_t netbsd32_sigactionp_t;
struct netbsd32_sigaction13 {
netbsd32_voidp netbsd32_sa_handler; /* signal handler */
sigset13_t netbsd32_sa_mask; /* signal mask to apply */
int netbsd32_sa_flags; /* see signal options below */
};
struct netbsd32_sigaction {
netbsd32_voidp netbsd32_sa_handler; /* signal handler */
sigset_t netbsd32_sa_mask; /* signal mask to apply */

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_signal.c,v 1.37 2012/02/19 21:06:41 rmind Exp $ */
/* $NetBSD: netbsd32_signal.c,v 1.38 2014/01/24 22:10:47 christos Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_signal.c,v 1.37 2012/02/19 21:06:41 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_signal.c,v 1.38 2014/01/24 22:10:47 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -65,7 +65,7 @@ netbsd32_sigaction(struct lwp *l, const struct netbsd32_sigaction_args *uap, reg
syscallarg(netbsd32_sigactionp_t) osa;
} */
struct sigaction nsa, osa;
struct netbsd32_sigaction *sa32p, sa32;
struct netbsd32_sigaction13 *sa32p, sa32;
int error;
if (SCARG_P32(uap, nsa)) {
@ -73,7 +73,8 @@ netbsd32_sigaction(struct lwp *l, const struct netbsd32_sigaction_args *uap, reg
if (copyin(sa32p, &sa32, sizeof(sa32)))
return EFAULT;
nsa.sa_handler = (void *)NETBSD32PTR64(sa32.netbsd32_sa_handler);
nsa.sa_mask = sa32.netbsd32_sa_mask;
memset(&nsa.sa_mask, 0, sizeof(nsa.sa_mask));
nsa.sa_mask.__bits[0] = sa32.netbsd32_sa_mask;
nsa.sa_flags = sa32.netbsd32_sa_flags;
}
error = sigaction1(l, SCARG(uap, signum),
@ -86,7 +87,7 @@ netbsd32_sigaction(struct lwp *l, const struct netbsd32_sigaction_args *uap, reg
if (SCARG_P32(uap, osa)) {
NETBSD32PTR32(sa32.netbsd32_sa_handler, osa.sa_handler);
sa32.netbsd32_sa_mask = osa.sa_mask;
sa32.netbsd32_sa_mask = osa.sa_mask.__bits[0];
sa32.netbsd32_sa_flags = osa.sa_flags;
sa32p = SCARG_P32(uap, osa);
if (copyout(&sa32, sa32p, sizeof(sa32)))