summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2017-12-12 15:07:20 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2017-12-12 15:07:55 +0000
commit8569e68ef8ea068cce30a0547ea01d858ad4c9d2 (patch)
treeaa1a80a8e405fb8f5ac0be365123ba6c25f49784
parent0fdac07978db62c0192855169f837f4ea73f27e1 (diff)
downloadillumos-joyent-8569e68ef8ea068cce30a0547ea01d858ad4c9d2.tar.gz
OS-6514 lx /proc/mounts should filter unknown mount options
Reviewed by: Dan McDonald <danmcd@joyent.com> Reviewed by: Jason King <jason.king@joyent.com> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/uts/common/brand/lx/procfs/lx_prvnops.c31
-rw-r--r--usr/src/uts/common/brand/lx/syscall/lx_mount.c18
2 files changed, 44 insertions, 5 deletions
diff --git a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
index 619613063b..349f4a55d5 100644
--- a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
+++ b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
@@ -2030,6 +2030,25 @@ static int lxpr_zfs_fstype = -1;
#define LXPR_ROOT_MOUNT_ID 15
#define LXPR_MNT_OPT_CHUNK 128
+/* List of native, non-Linux mount options we should omit. */
+static const char *lx_invalid_mnt_opts[] = {
+ "xattr",
+ NULL
+};
+
+/* First see if we should omit this option */
+static boolean_t
+lxpr_skip_mntopt(const char *s)
+{
+ uint_t i;
+
+ for (i = 0; lx_invalid_mnt_opts[i] != NULL; i++) {
+ if (strcmp(s, lx_invalid_mnt_opts[i]) == 0)
+ return (B_TRUE);
+ }
+ return (B_FALSE);
+}
+
static void
lxpr_append_mntopt(lxpr_mount_entry_t *lme, char *s)
{
@@ -2081,11 +2100,13 @@ lxpr_get_mntopts(vfs_t *vfsp, lxpr_mount_entry_t *lme)
strcmp(mop->mo_name, "nodevices") == 0)
have_nodev = B_TRUE;
- lxpr_append_mntopt(lme, ",");
- lxpr_append_mntopt(lme, mop->mo_name);
- if (mop->mo_arg != NULL) {
- lxpr_append_mntopt(lme, "=");
- lxpr_append_mntopt(lme, mop->mo_arg);
+ if (!lxpr_skip_mntopt(mop->mo_name)) {
+ lxpr_append_mntopt(lme, ",");
+ lxpr_append_mntopt(lme, mop->mo_name);
+ if (mop->mo_arg != NULL) {
+ lxpr_append_mntopt(lme, "=");
+ lxpr_append_mntopt(lme, mop->mo_arg);
+ }
}
}
diff --git a/usr/src/uts/common/brand/lx/syscall/lx_mount.c b/usr/src/uts/common/brand/lx/syscall/lx_mount.c
index 46d16030d5..2524e9044a 100644
--- a/usr/src/uts/common/brand/lx/syscall/lx_mount.c
+++ b/usr/src/uts/common/brand/lx/syscall/lx_mount.c
@@ -132,6 +132,17 @@ static mount_opt_t lx_autofs_options[] = {
{ NULL, MOUNT_OPT_INVALID }
};
+static const char *lx_common_mnt_opts[] = {
+ "exec",
+ "noexec",
+ "devices",
+ "nodevices",
+ "dev",
+ "nodev",
+ "suid",
+ "nosuid",
+ NULL
+};
/*
* Check the mount options.
@@ -183,6 +194,12 @@ lx_mnt_opt_verify(char *opts, mount_opt_t *mop)
for (;;) {
opt_len = strlen(opt);
+ /* Check common options we support on all filesystems */
+ for (i = 0; lx_common_mnt_opts[i] != NULL; i++) {
+ if (strcmp(opt, lx_common_mnt_opts[i]) == 0)
+ goto next_opt;
+ }
+
/* Check for matching option/value pair. */
for (i = 0; mop[i].mo_name != NULL; i++) {
char *ovalue;
@@ -252,6 +269,7 @@ lx_mnt_opt_verify(char *opts, mount_opt_t *mop)
goto bad;
}
+next_opt:
/*
* This option is ok, either we're done or move on to the next
* option.