diff --git a/sys/compat/svr4/svr4_fcntl.c b/sys/compat/svr4/svr4_fcntl.c index cf2fa0a3390b..e63ac02cde0c 100644 --- a/sys/compat/svr4/svr4_fcntl.c +++ b/sys/compat/svr4/svr4_fcntl.c @@ -30,12 +30,16 @@ * * $FreeBSD$ */ + +#include "opt_mac.h" + #include #include #include #include /*#include */ #include +#include #include #include #include @@ -260,6 +264,14 @@ fd_revoke(td, fd) goto out; } +#ifdef MAC + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); + error = mac_check_vnode_revoke(td->td_ucred, vp); + VOP_UNLOCK(vp, 0, td); + if (error) + goto out; +#endif + if ((error = VOP_GETATTR(vp, &vattr, td->td_ucred, td)) != 0) goto out; diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index f60d62c3605b..6f7a65ea7288 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -35,6 +35,8 @@ * handled here. */ +#include "opt_mac.h" + #include #include #include @@ -43,6 +45,7 @@ #include #include #include +#include #include #include /* Must come after sys/malloc.h */ #include @@ -310,6 +313,12 @@ again: cookies = NULL; } +#ifdef MAC + error = mac_check_vnode_readdir(td->td_ucred, vp); + if (error) + return (error); +#endif + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, &ncookies, &cookies); if (error) { @@ -462,6 +471,13 @@ again: auio.uio_td = td; auio.uio_resid = buflen; auio.uio_offset = off; + +#ifdef MAC + error = mac_check_vnode_readdir(td->td_ucred, vp); + if (error) + goto out; +#endif + /* * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time.