diff options
| author | jdolecek <jdolecek@NetBSD.org> | 2001-03-24 11:13:04 +0000 |
|---|---|---|
| committer | jdolecek <jdolecek@NetBSD.org> | 2001-03-24 11:13:04 +0000 |
| commit | 569cf4b76478d1f2b557cfcfe33d7215ea2834af (patch) | |
| tree | e706841efc4c052c5a62284ca2989631e1d043d5 /sys/compat/linux/common/linux_exec.c | |
| parent | 10b43f7cd4987f7e685842de245fa0c1a2d0bfc2 (diff) | |
Use parent's vmspace in linux_e_proc_fork() hook, the child does not
have vmspace setup yet. This fixes lossage discussed on current-users,
thread "hard lockups with -current and Netscape", and should fix
kern/12433 by <kawamoto@tenjin.org>, maybe also kern/12455.
XXX Threads forked via linux_sys_clone() should share the brk value
XXX if they share vmspace. This needs to be implemented.
Diffstat (limited to 'sys/compat/linux/common/linux_exec.c')
| -rw-r--r-- | sys/compat/linux/common/linux_exec.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/sys/compat/linux/common/linux_exec.c b/sys/compat/linux/common/linux_exec.c index c6830d78cee..b47530eded1 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.47 2001/03/22 08:26:14 itojun Exp $ */ +/* $NetBSD: linux_exec.c,v 1.48 2001/03/24 11:13:04 jdolecek Exp $ */ /*- * Copyright (c) 1994, 1995, 1998, 2000 The NetBSD Foundation, Inc. @@ -76,6 +76,7 @@ void syscall __P((void)); static void linux_e_proc_exec __P((struct proc *, struct exec_package *)); static void linux_e_proc_fork __P((struct proc *, struct proc *)); static void linux_e_proc_exit __P((struct proc *)); +static void linux_e_proc_init __P((struct proc *, struct vmspace *)); /* * Execve(2). Just check the alternate emulation path, and pass it on @@ -132,15 +133,10 @@ const struct emul emul_linux = { #endif }; -/* - * Allocate per-process structures. Called when executing Linux - * process. We can re-used the old emuldata - if it's not null, - * the executed process is of same emulation as original forked one. - */ static void -linux_e_proc_exec(p, epp) +linux_e_proc_init(p, vmspace) struct proc *p; - struct exec_package *epp; + struct vmspace *vmspace; { if (!p->p_emuldata) { /* allocate new Linux emuldata */ @@ -150,11 +146,23 @@ linux_e_proc_exec(p, epp) memset(p->p_emuldata, '\0', sizeof(struct linux_emuldata)); - if (p->p_vmspace) { - /* Set the process idea of the break to the real value */ - ((struct linux_emuldata*)(p->p_emuldata))->p_break = - p->p_vmspace->vm_daddr + ctob(p->p_vmspace->vm_dsize); - } + /* Set the process idea of the break to the real value */ + ((struct linux_emuldata*)(p->p_emuldata))->p_break = + vmspace->vm_daddr + ctob(vmspace->vm_dsize); +} + +/* + * Allocate per-process structures. Called when executing Linux + * process. We can reuse the old emuldata - if it's not null, + * the executed process is of same emulation as original forked one. + */ +static void +linux_e_proc_exec(p, epp) + struct proc *p; + struct exec_package *epp; +{ + /* exec, use our vmspace */ + linux_e_proc_init(p, p->p_vmspace); } /* @@ -182,5 +190,7 @@ linux_e_proc_fork(p, parent) * So just allocate new emuldata for the new process. */ p->p_emuldata = NULL; - linux_e_proc_exec(p, NULL); + + /* fork, use parent's vmspace (our vmspace may not be setup yet) */ + linux_e_proc_init(p, parent->p_vmspace); } |
