summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2012-01-17 01:08:01 +0000
committermckusick <mckusick@FreeBSD.org>2012-01-17 01:08:01 +0000
commitaf2e331939df2a83069ad4a6f5ab17eea9f82e8b (patch)
treed86ee8d3b7ab24d269286610b64ea734ff3b46d3 /sys/kern/vfs_mount.c
parentbf2ee27f25b4986447b996be48d5f5ce77c3ec40 (diff)
downloadFreeBSD-src-af2e331939df2a83069ad4a6f5ab17eea9f82e8b.zip
FreeBSD-src-af2e331939df2a83069ad4a6f5ab17eea9f82e8b.tar.gz
Make sure all intermediate variables holding mount flags (mnt_flag)
and that all internal kernel calls passing mount flags are declared as uint64_t so that flags in the top 32-bits are not lost. MFC after: 2 weeks
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r--sys/kern/vfs_mount.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 9100a9c..5fa086c 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -72,8 +72,8 @@ __FBSDID("$FreeBSD$");
#define VFS_MOUNTARG_SIZE_MAX (1024 * 64)
-static int vfs_domount(struct thread *td, const char *fstype,
- char *fspath, int fsflags, struct vfsoptlist **optlist);
+static int vfs_domount(struct thread *td, const char *fstype, char *fspath,
+ uint64_t fsflags, struct vfsoptlist **optlist);
static void free_mntarg(struct mntarg *ma);
static int usermount = 0;
@@ -378,10 +378,18 @@ sys_nmount(td, uap)
struct uio *auio;
int error;
u_int iovcnt;
+ uint64_t flags;
- AUDIT_ARG_FFLAGS(uap->flags);
+ /*
+ * Mount flags are now 64-bits. On 32-bit archtectures only
+ * 32-bits are passed in, but from here on everything handles
+ * 64-bit flags correctly.
+ */
+ flags = uap->flags;
+
+ AUDIT_ARG_FFLAGS(flags);
CTR4(KTR_VFS, "%s: iovp %p with iovcnt %d and flags %d", __func__,
- uap->iovp, uap->iovcnt, uap->flags);
+ uap->iovp, uap->iovcnt, flags);
/*
* Filter out MNT_ROOTFS. We do not want clients of nmount() in
@@ -390,7 +398,7 @@ sys_nmount(td, uap)
* MNT_ROOTFS should only be set by the kernel when mounting its
* root file system.
*/
- uap->flags &= ~MNT_ROOTFS;
+ flags &= ~MNT_ROOTFS;
iovcnt = uap->iovcnt;
/*
@@ -409,7 +417,7 @@ sys_nmount(td, uap)
__func__, error);
return (error);
}
- error = vfs_donmount(td, uap->flags, auio);
+ error = vfs_donmount(td, flags, auio);
free(auio, M_IOV);
return (error);
@@ -520,7 +528,7 @@ vfs_mount_destroy(struct mount *mp)
}
int
-vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions)
+vfs_donmount(struct thread *td, uint64_t fsflags, struct uio *fsoptions)
{
struct vfsoptlist *optlist;
struct vfsopt *opt, *tmp_opt;
@@ -696,9 +704,17 @@ sys_mount(td, uap)
char *fstype;
struct vfsconf *vfsp = NULL;
struct mntarg *ma = NULL;
+ uint64_t flags;
int error;
- AUDIT_ARG_FFLAGS(uap->flags);
+ /*
+ * Mount flags are now 64-bits. On 32-bit archtectures only
+ * 32-bits are passed in, but from here on everything handles
+ * 64-bit flags correctly.
+ */
+ flags = uap->flags;
+
+ AUDIT_ARG_FFLAGS(flags);
/*
* Filter out MNT_ROOTFS. We do not want clients of mount() in
@@ -707,7 +723,7 @@ sys_mount(td, uap)
* MNT_ROOTFS should only be set by the kernel when mounting its
* root file system.
*/
- uap->flags &= ~MNT_ROOTFS;
+ flags &= ~MNT_ROOTFS;
fstype = malloc(MFSNAMELEN, M_TEMP, M_WAITOK);
error = copyinstr(uap->type, fstype, MFSNAMELEN, NULL);
@@ -731,11 +747,11 @@ sys_mount(td, uap)
ma = mount_argsu(ma, "fstype", uap->type, MNAMELEN);
ma = mount_argsu(ma, "fspath", uap->path, MNAMELEN);
- ma = mount_argb(ma, uap->flags & MNT_RDONLY, "noro");
- ma = mount_argb(ma, !(uap->flags & MNT_NOSUID), "nosuid");
- ma = mount_argb(ma, !(uap->flags & MNT_NOEXEC), "noexec");
+ ma = mount_argb(ma, flags & MNT_RDONLY, "noro");
+ ma = mount_argb(ma, !(flags & MNT_NOSUID), "nosuid");
+ ma = mount_argb(ma, !(flags & MNT_NOEXEC), "noexec");
- error = vfsp->vfc_vfsops->vfs_cmount(ma, uap->data, uap->flags);
+ error = vfsp->vfc_vfsops->vfs_cmount(ma, uap->data, flags);
mtx_unlock(&Giant);
return (error);
}
@@ -749,7 +765,7 @@ vfs_domount_first(
struct vfsconf *vfsp, /* File system type. */
char *fspath, /* Mount path. */
struct vnode *vp, /* Vnode to be covered. */
- int fsflags, /* Flags common to all filesystems. */
+ uint64_t fsflags, /* Flags common to all filesystems. */
struct vfsoptlist **optlist /* Options local to the filesystem. */
)
{
@@ -871,14 +887,15 @@ static int
vfs_domount_update(
struct thread *td, /* Calling thread. */
struct vnode *vp, /* Mount point vnode. */
- int fsflags, /* Flags common to all filesystems. */
+ uint64_t fsflags, /* Flags common to all filesystems. */
struct vfsoptlist **optlist /* Options local to the filesystem. */
)
{
struct oexport_args oexport;
struct export_args export;
struct mount *mp;
- int error, export_error, flag;
+ int error, export_error;
+ uint64_t flag;
mtx_assert(&Giant, MA_OWNED);
ASSERT_VOP_ELOCKED(vp, __func__);
@@ -1015,7 +1032,7 @@ vfs_domount(
struct thread *td, /* Calling thread. */
const char *fstype, /* Filesystem type. */
char *fspath, /* Mount path. */
- int fsflags, /* Flags common to all filesystems. */
+ uint64_t fsflags, /* Flags common to all filesystems. */
struct vfsoptlist **optlist /* Options local to the filesystem. */
)
{
@@ -1216,7 +1233,7 @@ dounmount(mp, flags, td)
{
struct vnode *coveredvp, *fsrootvp;
int error;
- int async_flag;
+ uint64_t async_flag;
int mnt_gen_r;
mtx_assert(&Giant, MA_OWNED);
@@ -1925,7 +1942,7 @@ free_mntarg(struct mntarg *ma)
* Mount a filesystem
*/
int
-kernel_mount(struct mntarg *ma, int flags)
+kernel_mount(struct mntarg *ma, uint64_t flags)
{
struct uio auio;
int error;
OpenPOWER on IntegriCloud