Mercurial > illumos > illumos-gate
changeset 2899:886fb919e004
6439016 Race between getproc and prfind_zone
author | gjelinek |
---|---|
date | Wed, 11 Oct 2006 06:38:28 -0700 |
parents | a9d0a48c9ff7 |
children | 8188e64c9073 |
files | usr/src/uts/common/os/fork.c |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/os/fork.c Wed Oct 11 06:24:52 2006 -0700 +++ b/usr/src/uts/common/os/fork.c Wed Oct 11 06:38:28 2006 -0700 @@ -887,6 +887,12 @@ mutex_init(&cp->p_maplock, NULL, MUTEX_DEFAULT, NULL); cp->p_stat = SIDL; cp->p_mstart = gethrtime(); + /* + * p_zone must be set before we call pid_allocate since the process + * will be visible after that and code such as prfind_zone will + * look at the p_zone field. + */ + cp->p_zone = pp->p_zone; if ((newpid = pid_allocate(cp, PID_ALLOC_PROC)) == -1) { if (nproc == v.v_proc) { @@ -935,7 +941,6 @@ sess_hold(pp); cp->p_exec = pp->p_exec; cp->p_execdir = pp->p_execdir; - cp->p_zone = pp->p_zone; cp->p_brand = pp->p_brand; if (PROC_IS_BRANDED(pp)) BROP(pp)->b_copy_procdata(cp, pp);