git: 5c8af592f69a - main - procctl(PROC_REAP_KILL): align error reporting with pgkill(2)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 21 Feb 2026 10:07:58 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=5c8af592f69a31da94c45722dcd74afcf0ab375e
commit 5c8af592f69a31da94c45722dcd74afcf0ab375e
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-02-18 08:22:51 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-02-21 09:45:47 +0000
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
---
sys/kern/kern_procctl.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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;
}