The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=606061ea463dd1d7c3664b296e569b4b25d0f275
commit 606061ea463dd1d7c3664b296e569b4b25d0f275 Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-05-20 02:14:24 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-07-07 01:25:08 +0000 sys: add AUE_PDOPENPID Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- sys/bsm/audit_kevents.h | 1 + sys/kern/sys_procdesc.c | 3 +++ sys/kern/syscalls.master | 2 +- sys/security/audit/audit_bsm.c | 10 ++++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/bsm/audit_kevents.h b/sys/bsm/audit_kevents.h index ac6f5d69f07d..fb54f179d677 100644 --- a/sys/bsm/audit_kevents.h +++ b/sys/bsm/audit_kevents.h @@ -665,6 +665,7 @@ #define AUE_SETCRED 43271 /* FreeBSD-specific. */ #define AUE_INOTIFY 43272 /* FreeBSD/Linux. */ #define AUE_PDRFORK 43273 /* FreeBSD-specific. */ +#define AUE_PDOPENPID 43274 /* FreeBSD-specific. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index 3fca3ea29b18..4749a9b8bf7e 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -695,6 +695,9 @@ kern_pdopenpid(struct thread *td, pid_t pid, int flags) int sys_pdopenpid(struct thread *td, struct pdopenpid_args *args) { + AUDIT_ARG_PID(args->pid); + AUDIT_ARG_FFLAGS(args->flags); + if ((args->flags & ~(PD_ALLOWED_AT_FORK)) != 0) return (EINVAL); return (kern_pdopenpid(td, args->pid, args->flags)); diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 41580d0c4595..8ea32a7b0058 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -3429,7 +3429,7 @@ int flags ); } -603 AUE_NULL STD { +603 AUE_PDOPENPID STD { int pdopenpid( pid_t pid, int flags diff --git a/sys/security/audit/audit_bsm.c b/sys/security/audit/audit_bsm.c index 4654b607aea5..8873eb877234 100644 --- a/sys/security/audit/audit_bsm.c +++ b/sys/security/audit/audit_bsm.c @@ -1412,6 +1412,16 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau) kau_write(rec, tok); } break; + case AUE_PDOPENPID: + if (ARG_IS_VALID(kar, ARG_PID)) { + tok = au_to_arg32(1, "PID", ar->ar_arg_pid); + kau_write(rec, tok); + } + if (ARG_IS_VALID(kar, ARG_FFLAGS)) { + tok = au_to_arg32(2, "flags", ar->ar_arg_fflags); + kau_write(rec, tok); + } + break; case AUE_PROCCTL: if (ARG_IS_VALID(kar, ARG_VALUE)) {
