kcmp_pget(): do not accept TIDs

Otherwise pget() might still look up and hold the current process.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
This commit is contained in:
Konstantin Belousov 2024-04-30 00:04:25 +03:00
parent 1e01650a78
commit 5b3e5c6ce3

View file

@ -2098,7 +2098,8 @@ kcmp_pget(struct thread *td, pid_t pid, struct proc **pp)
*pp = td->td_proc;
return (0);
}
error = pget(pid, PGET_CANDEBUG | PGET_NOTWEXIT | PGET_HOLD, pp);
error = pget(pid, PGET_NOTID | PGET_CANDEBUG | PGET_NOTWEXIT |
PGET_HOLD, pp);
MPASS(*pp != td->td_proc);
return (error);
}