mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
fsetown: Avoid process group lock recursion
Restore the pre-1d874ba4f8ba behaviour of disassociating the current
SIGIO recipient before looking up the specified process or process
group. This avoids a lock recursion in the scenario where a process
group is configured to receive SIGIO for an fd when it has already been
so configured.
Reported by: pho
Tested by: pho
Reviewed by: kib
(cherry picked from commit 7326e8589c)
This commit is contained in:
parent
d8b1ffc8e2
commit
32d4139b3e
1 changed files with 2 additions and 5 deletions
|
|
@ -1158,14 +1158,12 @@ fsetown(pid_t pgid, struct sigio **sigiop)
|
|||
sigio->sio_ucred = crhold(curthread->td_ucred);
|
||||
sigio->sio_myref = sigiop;
|
||||
|
||||
osigio = NULL;
|
||||
ret = 0;
|
||||
if (pgid > 0) {
|
||||
ret = pget(pgid, PGET_NOTWEXIT | PGET_NOTID | PGET_HOLD, &proc);
|
||||
SIGIO_LOCK();
|
||||
osigio = funsetown_locked(*sigiop);
|
||||
if (ret == 0) {
|
||||
osigio = funsetown_locked(*sigiop);
|
||||
|
||||
PROC_LOCK(proc);
|
||||
_PRELE(proc);
|
||||
if ((proc->p_flag & P_WEXIT) != 0) {
|
||||
|
|
@ -1191,12 +1189,11 @@ fsetown(pid_t pgid, struct sigio **sigiop)
|
|||
} else /* if (pgid < 0) */ {
|
||||
sx_slock(&proctree_lock);
|
||||
SIGIO_LOCK();
|
||||
osigio = funsetown_locked(*sigiop);
|
||||
pgrp = pgfind(-pgid);
|
||||
if (pgrp == NULL) {
|
||||
ret = ESRCH;
|
||||
} else {
|
||||
osigio = funsetown_locked(*sigiop);
|
||||
|
||||
if (pgrp->pg_session != curthread->td_proc->p_session) {
|
||||
/*
|
||||
* Policy - Don't allow a process to FSETOWN a
|
||||
|
|
|
|||
Loading…
Reference in a new issue