From ecd764b0ea7a1b7fb5f1e6632f8d8db9233f06ea Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sat, 19 Mar 2022 21:59:13 -0400 Subject: [PATCH] audit: Initialize vattr fields before calling VOP_GETATTR Some filesystems do not fill out certain optional vattr fields. To ensure that they do not get copied out to userspace uninitialized, use VATTR_NULL to provide default values. Reported by: KMSAN MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/security/audit/audit_arg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/security/audit/audit_arg.c b/sys/security/audit/audit_arg.c index a917b5b6e29..7e0b0de2abf 100644 --- a/sys/security/audit/audit_arg.c +++ b/sys/security/audit/audit_arg.c @@ -873,6 +873,7 @@ audit_arg_vnode(struct vnode *vp, struct vnode_au_info *vnp) ASSERT_VOP_LOCKED(vp, "audit_arg_vnode"); + VATTR_NULL(&vattr); error = VOP_GETATTR(vp, &vattr, curthread->td_ucred); if (error) { /* XXX: How to handle this case? */