Call audit hooks to capture vnode attributes for three file-descriptor

method implementations: fstat(2), close(2), and poll(2).  This change
synchronises auditing here with similar auditing for VFS-specific system
calls such as stat(2) that audit more complete vnode information.

Sponsored by:	DARPA, AFRL
Approved by:	re (kib)
MFC after:	1 week
This commit is contained in:
Robert Watson 2016-07-05 16:37:01 +00:00
parent 1cbb879df8
commit 971711fb7c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=302345

View File

@ -440,6 +440,7 @@ vn_close(vp, flags, file_cred, td)
vn_start_write(vp, &mp, V_WAIT);
vn_lock(vp, lock_flags | LK_RETRY);
AUDIT_ARG_VNODE1(vp);
if ((flags & (FWRITE | FOPENFAILED)) == FWRITE) {
VNASSERT(vp->v_writecount > 0, vp,
("vn_close: negative writecount"));
@ -1362,6 +1363,7 @@ vn_stat(vp, sb, active_cred, file_cred, td)
int error;
u_short mode;
AUDIT_ARG_VNODE1(vp);
#ifdef MAC
error = mac_vnode_check_stat(active_cred, file_cred, vp);
if (error)
@ -1511,6 +1513,7 @@ vn_poll(fp, events, active_cred, td)
vp = fp->f_vnode;
#ifdef MAC
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
AUDIT_ARG_VNODE1(vp);
error = mac_vnode_check_poll(active_cred, fp->f_cred, vp);
VOP_UNLOCK(vp, 0);
if (!error)