The branch main has been updated by mjg:

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

commit cf0fc64bc2f91bc00c78b316b51a0aaac8b53235
Author:     Mateusz Guzik <[email protected]>
AuthorDate: 2023-05-03 06:56:10 +0000
Commit:     Mateusz Guzik <[email protected]>
CommitDate: 2023-05-03 06:56:10 +0000

    vfs: reduce audit branching in namei_setup
---
 sys/kern/vfs_lookup.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 66a8b267f346..a75ea4ca16d6 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -372,10 +372,12 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, 
struct pwd **pwdp)
        /*
         * If we are auditing the kernel pathname, save the user pathname.
         */
-       if (cnp->cn_flags & AUDITVNODE1)
-               AUDIT_ARG_UPATH1_VP(td, ndp->ni_rootdir, *dpp, cnp->cn_pnbuf);
-       if (cnp->cn_flags & AUDITVNODE2)
-               AUDIT_ARG_UPATH2_VP(td, ndp->ni_rootdir, *dpp, cnp->cn_pnbuf);
+       if (AUDITING_TD(td)) {
+               if (cnp->cn_flags & AUDITVNODE1)
+                       AUDIT_ARG_UPATH1_VP(td, ndp->ni_rootdir, *dpp, 
cnp->cn_pnbuf);
+               if (cnp->cn_flags & AUDITVNODE2)
+                       AUDIT_ARG_UPATH2_VP(td, ndp->ni_rootdir, *dpp, 
cnp->cn_pnbuf);
+       }
        if (ndp->ni_startdir != NULL && !startdir_used)
                vrele(ndp->ni_startdir);
        if (error != 0) {

Reply via email to