mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
linux(4): Check that the thread tid in the thread group pid in linux_tdfind().
MFC after: 2 weeks
This commit is contained in:
parent
bbddd5881d
commit
fe894a3705
1 changed files with 26 additions and 26 deletions
|
|
@ -2710,34 +2710,34 @@ linux_tdfind(struct thread *td, lwpid_t tid, pid_t pid)
|
|||
|
||||
tdt = NULL;
|
||||
if (tid == 0 || tid == td->td_tid) {
|
||||
tdt = td;
|
||||
PROC_LOCK(tdt->td_proc);
|
||||
if (pid != -1 && td->td_proc->p_pid != pid)
|
||||
return (NULL);
|
||||
PROC_LOCK(td->td_proc);
|
||||
return (td);
|
||||
} else if (tid > PID_MAX)
|
||||
tdt = tdfind(tid, pid);
|
||||
else {
|
||||
/*
|
||||
* Initial thread where the tid equal to the pid.
|
||||
*/
|
||||
p = pfind(tid);
|
||||
if (p != NULL) {
|
||||
if (SV_PROC_ABI(p) != SV_ABI_LINUX) {
|
||||
/*
|
||||
* p is not a Linuxulator process.
|
||||
*/
|
||||
PROC_UNLOCK(p);
|
||||
return (NULL);
|
||||
}
|
||||
FOREACH_THREAD_IN_PROC(p, tdt) {
|
||||
em = em_find(tdt);
|
||||
if (tid == em->em_tid)
|
||||
return (tdt);
|
||||
}
|
||||
PROC_UNLOCK(p);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
return (tdfind(tid, pid));
|
||||
|
||||
return (tdt);
|
||||
/*
|
||||
* Initial thread where the tid equal to the pid.
|
||||
*/
|
||||
p = pfind(tid);
|
||||
if (p != NULL) {
|
||||
if (SV_PROC_ABI(p) != SV_ABI_LINUX ||
|
||||
(pid != -1 && tid != pid)) {
|
||||
/*
|
||||
* p is not a Linuxulator process.
|
||||
*/
|
||||
PROC_UNLOCK(p);
|
||||
return (NULL);
|
||||
}
|
||||
FOREACH_THREAD_IN_PROC(p, tdt) {
|
||||
em = em_find(tdt);
|
||||
if (tid == em->em_tid)
|
||||
return (tdt);
|
||||
}
|
||||
PROC_UNLOCK(p);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Reference in a new issue