Explicitly zerofill some fields which are not within the boundaries

of p_start/endzero for whatever reasons.

Obviously, this fixes remote physio when running with MALLOC_OPTIONS J.
Otherwise PS_WEXIT is set in struct proc, proc_vmspace_getref() fails,
and copyout_proc() with it.

Reported by njoly
This commit is contained in:
pooka 2011-02-10 13:40:35 +00:00
parent a0925f0154
commit 1745060603

View File

@ -1,4 +1,4 @@
/* $NetBSD: lwproc.c,v 1.14 2011/02/10 13:31:30 pooka Exp $ */
/* $NetBSD: lwproc.c,v 1.15 2011/02/10 13:40:35 pooka Exp $ */
/*
* Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.14 2011/02/10 13:31:30 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.15 2011/02/10 13:40:35 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@ -112,6 +112,16 @@ lwproc_newproc(struct proc *parent, int flags)
offsetof(struct proc, p_endcopy)
- offsetof(struct proc, p_startcopy));
/* some other garbage we need to zero */
p->p_sigacts = NULL;
p->p_aio = NULL;
p->p_dtrace = NULL;
p->p_mqueue_cnt = p->p_exitsig = 0;
p->p_flag = p->p_sflag = p->p_slflag = p->p_lflag = p->p_stflag = 0;
p->p_trace_enabled = 0;
p->p_xstat = p->p_acflag = 0;
p->p_stackbase = 0;
p->p_stats = pstatscopy(parent->p_stats);
p->p_vmspace = vmspace_kernel();