summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_stats.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2002-08-01 22:23:02 +0000
committerrwatson <rwatson@FreeBSD.org>2002-08-01 22:23:02 +0000
commitb246ee0a3cced8c39f5aaa8505242e775d93e8c4 (patch)
tree1b32476766408c94dcee10b7fe67f140d5da3e23 /sys/compat/linux/linux_stats.c
parent41f4dc56d14bda3dbbebfdb61740397a2caf7321 (diff)
downloadFreeBSD-src-b246ee0a3cced8c39f5aaa8505242e775d93e8c4.zip
FreeBSD-src-b246ee0a3cced8c39f5aaa8505242e775d93e8c4.tar.gz
Introduce support for Mandatory Access Control and extensible
kernel access control. Invoke appropriate MAC entry points for a number of VFS-related operations in the Linux ABI module. In particular, handle uselib in a manner similar to open() (more work is probably needed here), as well as handle statfs(), and linux readdir()-like calls. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
Diffstat (limited to 'sys/compat/linux/linux_stats.c')
-rw-r--r--sys/compat/linux/linux_stats.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c
index 9da9323..5ceb22a 100644
--- a/sys/compat/linux/linux_stats.c
+++ b/sys/compat/linux/linux_stats.c
@@ -28,12 +28,15 @@
* $FreeBSD$
*/
+#include "opt_mac.h"
+
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/dirent.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/proc.h>
+#include <sys/mac.h>
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/stat.h>
@@ -247,6 +250,11 @@ linux_statfs(struct thread *td, struct linux_statfs_args *args)
mp = ndp->ni_vp->v_mount;
bsd_statfs = &mp->mnt_stat;
vrele(ndp->ni_vp);
+#ifdef MAC
+ error = mac_check_mount_stat(td->td_proc->p_ucred, mp);
+ if (error)
+ return (error);
+#endif
error = VFS_STATFS(mp, bsd_statfs, td);
if (error)
return error;
@@ -282,6 +290,13 @@ linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
if (error)
return error;
mp = ((struct vnode *)fp->f_data)->v_mount;
+#ifdef MAC
+ error = mac_check_mount_stat(td->td_proc->p_ucred, mp);
+ if (error) {
+ fdrop(fp, td);
+ return (error);
+ }
+#endif
bsd_statfs = &mp->mnt_stat;
error = VFS_STATFS(mp, bsd_statfs, td);
if (error) {
@@ -344,6 +359,11 @@ linux_ustat(struct thread *td, struct linux_ustat_args *args)
if (vfinddev(dev, VCHR, &vp)) {
if (vp->v_mount == NULL)
return (EINVAL);
+#ifdef MAC
+ error = mac_check_mount_stat(td->td_proc->p_ucred, mp);
+ if (error)
+ return (error);
+#endif
stat = &(vp->v_mount->mnt_stat);
error = VFS_STATFS(vp->v_mount, stat, td);
if (error)
OpenPOWER on IntegriCloud