- the signal trampoline address is now copied during a fork(). This avoids

a SIGSEGV when sigaction(2) is used before a fork(2) and a signal is received
in the child.
- we now nearly correctly emulate PR_TERMCHILD in prctl(2). (the perfect
emulation would not send a SIGHUP if the parent is killed)
This commit is contained in:
manu 2002-05-28 21:15:41 +00:00
parent 800bc79f00
commit f4e81e0cfb
9 changed files with 65 additions and 25 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_exec.c,v 1.14 2002/04/20 16:19:22 manu Exp $ */
/* $NetBSD: irix_exec.c,v 1.15 2002/05/28 21:15:41 manu Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.14 2002/04/20 16:19:22 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.15 2002/05/28 21:15:41 manu Exp $");
#ifndef ELFSIZE
#define ELFSIZE 32 /* XXX should die */
@ -62,6 +62,8 @@ __KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.14 2002/04/20 16:19:22 manu Exp $");
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_errno.h>
extern const int native_to_svr4_signo[];
static void setregs_n32 __P((struct proc *, struct exec_package *, u_long));
static void irix_e_proc_exec __P((struct proc *, struct exec_package *));
static void irix_e_proc_fork __P((struct proc *, struct proc *));
@ -295,6 +297,24 @@ static void
irix_e_proc_exit(p)
struct proc *p;
{
struct proc *pp;
struct irix_emuldata *ied;
LIST_FOREACH(pp, &allproc, p_list) {
/*
* Select IRIX processes.
* XXX not nice, but we need to do this
* before we reference p_emuldata.
*/
if (pp->p_emul != &emul_irix_o32 &&
pp->p_emul != &emul_irix_n32)
continue;
ied = (struct irix_emuldata *)(pp->p_emuldata);
if (ied->ied_pptr == p)
psignal(pp, native_to_svr4_signo[SIGHUP]);
}
FREE(p->p_emuldata, M_EMULDATA);
p->p_emuldata = NULL;
}
@ -306,8 +326,17 @@ static void
irix_e_proc_fork(p, parent)
struct proc *p, *parent;
{
struct irix_emuldata *ied1;
struct irix_emuldata *ied2;
p->p_emuldata = NULL;
/* Use parent's vmspace beacause our vmspace may not be setup yet) */
/* Use parent's vmspace beacause our vmspace may not be setup yet */
irix_e_proc_init(p, parent->p_vmspace);
ied1 = p->p_emuldata;
ied2 = parent->p_emuldata;
(void) memcpy(ied1, ied2, (unsigned)
((caddr_t)&ied1->ied_endcopy - (caddr_t)&ied1->ied_startcopy));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_exec.h,v 1.7 2002/04/20 16:19:22 manu Exp $ */
/* $NetBSD: irix_exec.h,v 1.8 2002/05/28 21:15:41 manu Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@ -51,7 +51,10 @@
/* IRIX specific per-process data */
struct irix_emuldata {
#define ied_startcopy ied_sigtramp
void *ied_sigtramp; /* Address of signal trampoline */
#define ied_endcopy ied_pptr
struct proc *ied_pptr; /* parent process or NULL */
};
/* e_flags used by IRIX for ABI selection */

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_misc.c,v 1.1 2002/04/20 07:42:32 manu Exp $ */
/* $NetBSD: irix_misc.c,v 1.2 2002/05/28 21:15:41 manu Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_misc.c,v 1.1 2002/04/20 07:42:32 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_misc.c,v 1.2 2002/05/28 21:15:41 manu Exp $");
#include <sys/types.h>
#include <sys/signal.h>
@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: irix_misc.c,v 1.1 2002/04/20 07:42:32 manu Exp $");
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_exec.h>
#include <compat/irix/irix_syscallargs.h>
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_prctl.c,v 1.9 2002/05/02 17:17:29 manu Exp $ */
/* $NetBSD: irix_prctl.c,v 1.10 2002/05/28 21:15:42 manu Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.9 2002/05/02 17:17:29 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.10 2002/05/28 21:15:42 manu Exp $");
#include <sys/errno.h>
#include <sys/types.h>
@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.9 2002/05/02 17:17:29 manu Exp $");
#include <compat/svr4/svr4_types.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_exec.h>
#include <compat/irix/irix_prctl.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_syscallargs.h>
@ -112,17 +113,23 @@ irix_sys_prctl(p, v, retval)
break;
}
case IRIX_PR_LASTSHEXIT: /* "Last sproc exit" */
case IRIX_PR_LASTSHEXIT: /* "Last sproc exit" */
/* We do nothing */
break;
case IRIX_PR_GETNSHARE: /* Number of sproc share group memb.*/
/* XXX This only gives threads that share VM space ... */
*retval = p->p_vmspace->vm_refcnt;
break;
case IRIX_PR_TERMCHILD: /* Send SIGHUP to parrent on exit */
p->p_exitsig = SIGHUP;
*retval = 0;
case IRIX_PR_TERMCHILD: { /* Send SIGHUP to children on exit */
struct irix_emuldata *ied;
ied = (struct irix_emuldata *)(p->p_emuldata);
ied->ied_pptr = p->p_pptr;
break;
}
default:
printf("Warning: call to unimplemented prctl() command %d\n",
option);

View File

@ -1,10 +1,10 @@
/* $NetBSD: irix_syscall.h,v 1.44 2002/05/22 05:14:01 manu Exp $ */
/* $NetBSD: irix_syscall.h,v 1.45 2002/05/28 21:15:42 manu Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.42 2002/05/04 07:45:05 manu Exp
* created from NetBSD: syscalls.master,v 1.43 2002/05/22 05:14:03 manu Exp
*/
/* syscall: "syscall" ret: "int" args: */

View File

@ -1,10 +1,10 @@
/* $NetBSD: irix_syscallargs.h,v 1.44 2002/05/22 05:14:51 manu Exp $ */
/* $NetBSD: irix_syscallargs.h,v 1.45 2002/05/28 21:15:42 manu Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.42 2002/05/04 07:45:05 manu Exp
* created from NetBSD: syscalls.master,v 1.43 2002/05/22 05:14:03 manu Exp
*/
#ifndef _IRIX_SYS__SYSCALLARGS_H_

View File

@ -1,14 +1,14 @@
/* $NetBSD: irix_syscalls.c,v 1.44 2002/05/22 05:14:02 manu Exp $ */
/* $NetBSD: irix_syscalls.c,v 1.45 2002/05/28 21:15:42 manu Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.42 2002/05/04 07:45:05 manu Exp
* created from NetBSD: syscalls.master,v 1.43 2002/05/22 05:14:03 manu Exp
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.44 2002/05/22 05:14:02 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.45 2002/05/28 21:15:42 manu Exp $");
#if defined(_KERNEL_OPT)
#if defined(_KERNEL_OPT)

View File

@ -1,14 +1,14 @@
/* $NetBSD: irix_sysent.c,v 1.44 2002/05/22 05:14:02 manu Exp $ */
/* $NetBSD: irix_sysent.c,v 1.45 2002/05/28 21:15:42 manu Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.42 2002/05/04 07:45:05 manu Exp
* created from NetBSD: syscalls.master,v 1.43 2002/05/22 05:14:03 manu Exp
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.44 2002/05/22 05:14:02 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.45 2002/05/28 21:15:42 manu Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_syssgi.c,v 1.26 2002/04/20 07:43:35 manu Exp $ */
/* $NetBSD: irix_syssgi.c,v 1.27 2002/05/28 21:15:42 manu Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_syssgi.c,v 1.26 2002/04/20 07:43:35 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_syssgi.c,v 1.27 2002/05/28 21:15:42 manu Exp $");
#include "opt_ddb.h"
@ -469,7 +469,7 @@ irix_syssgi_sysconf(name, p, retval)
default:
printf("Warning: syssgi(SYSCONF) unsupported variable %d\n",
name);
return EINVAL;
return EINVAL;
break;
}