procdesc: postpone freeing the zombie' pid until procdesc is freed
Requested by: asomers Reviewed by: asomers, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54592
This commit is contained in:
@@ -979,9 +979,9 @@ proc_reap(struct thread *td, struct proc *p, int *status, int options)
|
|||||||
leavepgrp(p);
|
leavepgrp(p);
|
||||||
if (p->p_procdesc != NULL)
|
if (p->p_procdesc != NULL)
|
||||||
procdesc_reap(p);
|
procdesc_reap(p);
|
||||||
sx_xunlock(&proctree_lock);
|
else
|
||||||
|
|
||||||
proc_id_clear(PROC_ID_PID, p->p_pid);
|
proc_id_clear(PROC_ID_PID, p->p_pid);
|
||||||
|
sx_xunlock(&proctree_lock);
|
||||||
|
|
||||||
PROC_LOCK(p);
|
PROC_LOCK(p);
|
||||||
knlist_detach(p->p_klist);
|
knlist_detach(p->p_klist);
|
||||||
|
|||||||
@@ -270,6 +270,9 @@ procdesc_free(struct procdesc *pd)
|
|||||||
KASSERT((pd->pd_flags & PDF_CLOSED),
|
KASSERT((pd->pd_flags & PDF_CLOSED),
|
||||||
("procdesc_free: !PDF_CLOSED"));
|
("procdesc_free: !PDF_CLOSED"));
|
||||||
|
|
||||||
|
if (pd->pd_pid != -1)
|
||||||
|
proc_id_clear(PROC_ID_PID, pd->pd_pid);
|
||||||
|
|
||||||
knlist_destroy(&pd->pd_selinfo.si_note);
|
knlist_destroy(&pd->pd_selinfo.si_note);
|
||||||
PROCDESC_LOCK_DESTROY(pd);
|
PROCDESC_LOCK_DESTROY(pd);
|
||||||
free(pd, M_PROCDESC);
|
free(pd, M_PROCDESC);
|
||||||
@@ -389,6 +392,7 @@ procdesc_close(struct file *fp, struct thread *td)
|
|||||||
*/
|
*/
|
||||||
pd->pd_proc = NULL;
|
pd->pd_proc = NULL;
|
||||||
p->p_procdesc = NULL;
|
p->p_procdesc = NULL;
|
||||||
|
pd->pd_pid = -1;
|
||||||
procdesc_free(pd);
|
procdesc_free(pd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user