diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2026-02-18 08:22:51 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2026-02-21 09:45:47 +0000 |
| commit | 5c8af592f69a31da94c45722dcd74afcf0ab375e (patch) | |
| tree | ddbc45aa11abfbc811a5f21fdf5920b0abfebd26 | |
| parent | 0e67c3f675eab3a9c00b76e3886ace7700ef1bd4 (diff) | |
procctl(PROC_REAP_KILL): align error reporting with pgkill(2)
ESRCH from cr_cansignal() means that the target process should be not
visible to the initiator. So do not report pids with ESRCH result.
Noted by: markj
Reviewed by: markj, olce
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D55341
| -rw-r--r-- | sys/kern/kern_procctl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 30ab37d56877..b1539c5cec4f 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -267,7 +267,11 @@ reap_kill_proc_locked(struct reap_kill_proc_work *w) error = cr_cansignal(w->cr, w->target, w->rk->rk_sig); if (error != 0) { - if (*w->error == ESRCH) { + /* + * Hide ESRCH errors to ensure that this function + * cannot be used as an oracle for process visibility. + */ + if (error != ESRCH && *w->error == 0) { w->rk->rk_fpid = w->target->p_pid; *w->error = error; } |
