aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/mount.h
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2020-06-14 00:10:18 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2020-06-14 00:10:18 +0000
commit1f7104d7203f410f0f7055d2a8f2fe628eed8dbc (patch)
treeb67a248267ba5a9d346a5ea66f66a4bac172d68f /sys/sys/mount.h
parente81d909274198da222c9efb11ccbbc651ebee09e (diff)
downloadsrc-1f7104d7203f410f0f7055d2a8f2fe628eed8dbc.tar.gz
src-1f7104d7203f410f0f7055d2a8f2fe628eed8dbc.zip
Fix export_args ex_flags field so that is 64bits, the same as mnt_flags.
Since mnt_flags was upgraded to 64bits there has been a quirk in "struct export_args", since it hold a copy of mnt_flags in ex_flags, which is an "int" (32bits). This happens to currently work, since all the flag bits used in ex_flags are defined in the low order 32bits. However, new export flags cannot be defined. Also, ex_anon is a "struct xucred", which limits it to 16 additional groups. This patch revises "struct export_args" to make ex_flags 64bits and replaces ex_anon with ex_uid, ex_ngroups and ex_groups (which points to a groups list, so it can be malloc'd up to NGROUPS in size. This requires that the VFS_CHECKEXP() arguments change, so I also modified the last "secflavors" argument to be an array pointer, so that the secflavors could be copied in VFS_CHECKEXP() while the export entry is locked. (Without this patch VFS_CHECKEXP() returns a pointer to the secflavors array and then it is used after being unlocked, which is potentially a problem if the exports entry is changed. In practice this does not occur when mountd is run with "-S", but I think it is worth fixing.) This patch also deleted the vfs_oexport_conv() function, since do_mount_update() does the conversion, as required by the old vfs_cmount() calls. Reviewed by: kib, freqlabs Relnotes: yes Differential Revision: https://reviews.freebsd.org/D25088
Notes
Notes: svn path=/head/; revision=362158
Diffstat (limited to 'sys/sys/mount.h')
-rw-r--r--sys/sys/mount.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 1477ffad9fe3..4ea41a0fedcc 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -499,10 +499,10 @@ struct oexport_args {
};
/*
- * Export arguments for local filesystem mount calls.
+ * Not quite so old export arguments with 32bit ex_flags and xucred ex_anon.
*/
#define MAXSECFLAVORS 5
-struct export_args {
+struct o2export_args {
int ex_flags; /* export related flags */
uid_t ex_root; /* mapping for root uid */
struct xucred ex_anon; /* mapping for anonymous user */
@@ -516,6 +516,25 @@ struct export_args {
};
/*
+ * Export arguments for local filesystem mount calls.
+ */
+#define MAXSECFLAVORS 5
+struct export_args {
+ uint64_t ex_flags; /* export related flags */
+ uid_t ex_root; /* mapping for root uid */
+ uid_t ex_uid; /* mapping for anonymous user */
+ int ex_ngroups;
+ gid_t *ex_groups;
+ struct sockaddr *ex_addr; /* net address to which exported */
+ u_char ex_addrlen; /* and the net address length */
+ struct sockaddr *ex_mask; /* mask of valid bits in saddr */
+ u_char ex_masklen; /* and the smask length */
+ char *ex_indexfile; /* index file for WebNFS URLs */
+ int ex_numsecflavors; /* security flavor count */
+ int ex_secflavors[MAXSECFLAVORS]; /* list of security flavors */
+};
+
+/*
* Structure holding information for a publicly exported filesystem
* (WebNFS). Currently the specs allow just for one such filesystem.
*/
@@ -694,8 +713,8 @@ typedef int vfs_vget_t(struct mount *mp, ino_t ino, int flags,
typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp,
int flags, struct vnode **vpp);
typedef int vfs_checkexp_t(struct mount *mp, struct sockaddr *nam,
- int *extflagsp, struct ucred **credanonp,
- int *numsecflavors, int **secflavors);
+ uint64_t *extflagsp, struct ucred **credanonp,
+ int *numsecflavors, int *secflavors);
typedef int vfs_init_t(struct vfsconf *);
typedef int vfs_uninit_t(struct vfsconf *);
typedef int vfs_extattrctl_t(struct mount *mp, int cmd,
@@ -928,8 +947,6 @@ void vfs_mount_error(struct mount *, const char *, ...);
void vfs_mountroot(void); /* mount our root filesystem */
void vfs_mountedfrom(struct mount *, const char *from);
void vfs_notify_upper(struct vnode *, int);
-void vfs_oexport_conv(const struct oexport_args *oexp,
- struct export_args *exp);
void vfs_ref(struct mount *);
void vfs_rel(struct mount *);
struct mount *vfs_mount_alloc(struct vnode *, struct vfsconf *, const char *,