pdopenpid(2): in cap mode, translate all errors from pdopenpid1() to ECAPMODE

to not leak information about unused pids or system processes' pids.

Reviewed by:	markj
Fixes:	73c92a978c ("pdopenpid(2): allow in capability mode with restrictions")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59252
This commit is contained in:
Konstantin Belousov committed 2026-09-01 16:56:34 +03:00
1 parent d675662876
commit 326ab530dc
1 file changed
+3
+3
View File
@@ -728,7 +728,10 @@ kern_pdopenpid(struct thread *td, pid_t pid, int flags)
fp->f_pdflags |= F_PD_NOKILL | F_PD_NOFINSTALL;
filecaps_free(&fcaps);
}
} else if (IN_CAPABILITY_MODE(td)) {
error = ECAPMODE;
}
fdrop(fp, td);
if (pdf != NULL) {