git: a559977dfb37 - main - fchaltroot(2): fix auditing
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 23 Nov 2026 00:16:06 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=a559977dfb37e01fb95a1386c7734eed72beec75
commit a559977dfb37e01fb95a1386c7734eed72beec75
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-11-21 08:20:07 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-23 00:10:24 +0000
fchaltroot(2): fix auditing
Audit fd and vnode.
Move the AUE_FCHALTROOT into the FD_VNODE1_TOKENS group.
Reported by: llm-postcr
Reviewed by: markj
Fixes: 9757c0cf98e4 ("chaltroot(2) and fchaltroot(2): new syscalls")
Fixes: 3dac77482537 ("sys: add AUE_CHALTROOT and AUE_FCHALTROOT")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D61862
---
sys/kern/vfs_syscalls.c | 3 +++
sys/security/audit/audit_bsm.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 1dd29a081a60..23de410cc74d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -5490,6 +5490,8 @@ sys_fchaltroot(struct thread *td, struct fchaltroot_args *uap)
int error;
uint8_t fdflags;
+ AUDIT_ARG_FD(uap->fd);
+
error = chroot_check_priv(td);
if (error != 0)
return (error);
@@ -5508,5 +5510,6 @@ sys_fchaltroot(struct thread *td, struct fchaltroot_args *uap)
vrefact(vp);
fdrop(fp, td);
vn_lock(vp, LK_SHARED | LK_RETRY);
+ AUDIT_ARG_VNODE1(vp);
return (change_altdir(td, vp));
}
diff --git a/sys/security/audit/audit_bsm.c b/sys/security/audit/audit_bsm.c
index b6eb906122bb..ba4f960b988c 100644
--- a/sys/security/audit/audit_bsm.c
+++ b/sys/security/audit/audit_bsm.c
@@ -829,7 +829,6 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau)
case AUE_CHALTROOT:
case AUE_CHDIR:
case AUE_CHROOT:
- case AUE_FCHALTROOT:
case AUE_FSTATAT:
case AUE_FUTIMESAT:
case AUE_GETATTRLIST:
@@ -1045,6 +1044,7 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau)
/*
* XXXRW: Some of these need to handle non-vnode cases as well.
*/
+ case AUE_FCHALTROOT:
case AUE_FCHDIR:
case AUE_FPATHCONF:
case AUE_FSTAT: