git: db1ef2a140ae - stable/15 - sys: add AUE_PDOPENPID

Konstantin Belousov <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a81248d.44918.25352574__44489.918479097$1786848550$gmane$org@gitrepo.freebsd.org>
The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=db1ef2a140ae333ad89511b69aeb928eb45e6806

commit db1ef2a140ae333ad89511b69aeb928eb45e6806
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2026-05-20 02:14:24 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-08-16 02:41:22 +0000

    sys: add AUE_PDOPENPID
    
    (cherry picked from commit 606061ea463dd1d7c3664b296e569b4b25d0f275)
---
 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 ec9d3ee9aa37..cc3cfa355133 100644
--- a/sys/kern/sys_procdesc.c
+++ b/sys/kern/sys_procdesc.c
@@ -698,6 +698,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 bc81f22d3cb4..41abbdb88075 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -3422,7 +3422,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 6cd96ebe092f..dc9cf2b5da16 100644
--- a/sys/security/audit/audit_bsm.c
+++ b/sys/security/audit/audit_bsm.c
@@ -1399,6 +1399,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)) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.