Make killpg1 perform process validity checks without proc lock held.

This commit is contained in:
Mateusz Guzik 2018-02-20 10:52:07 +00:00
parent 2c0f13aa59
commit 681a1b752c

View File

@ -1677,12 +1677,11 @@ killpg1(struct thread *td, int sig, int pgid, int all, ksiginfo_t *ksi)
*/ */
sx_slock(&allproc_lock); sx_slock(&allproc_lock);
FOREACH_PROC_IN_SYSTEM(p) { FOREACH_PROC_IN_SYSTEM(p) {
PROC_LOCK(p);
if (p->p_pid <= 1 || p->p_flag & P_SYSTEM || if (p->p_pid <= 1 || p->p_flag & P_SYSTEM ||
p == td->td_proc || p->p_state == PRS_NEW) { p == td->td_proc || p->p_state == PRS_NEW) {
PROC_UNLOCK(p);
continue; continue;
} }
PROC_LOCK(p);
err = p_cansignal(td, p, sig); err = p_cansignal(td, p, sig);
if (err == 0) { if (err == 0) {
if (sig) if (sig)