diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2016-09-06 15:37:11 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2016-09-06 15:38:06 +0000 |
commit | 12a530b543020dda34973ca16b31b66007141141 (patch) | |
tree | 71e26249b156987e9e03464766847e8204a0c783 | |
parent | f8d62f795c7b4727f20c41139e9576600cbd94bf (diff) | |
download | illumos-joyent-12a530b543020dda34973ca16b31b66007141141.tar.gz |
OS-5644 lx tmpfs mount with uid or gid option fails
OS-5646 lxbrand mount(2) target path handling could be improved
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Ryan Zezeski <ryan.zezeski@joyent.com>
Approved by: Patrick Mooney <patrick.mooney@joyent.com>
-rw-r--r-- | usr/src/uts/common/brand/lx/syscall/lx_mount.c | 13 |
1 files changed, 10 insertions, 3 deletions
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 825d70cf6a..254e8ec93a 100644 --- a/usr/src/uts/common/brand/lx/syscall/lx_mount.c +++ b/usr/src/uts/common/brand/lx/syscall/lx_mount.c @@ -95,6 +95,9 @@ typedef struct mount_opt { /* From uts/common/syscall/umount.c */ extern int umount2(char *, int); +/* From lx_chown.c */ +extern long lx_vn_chown(vnode_t *, uid_t, gid_t); + /* * Globals */ @@ -520,8 +523,8 @@ lx_mount(const char *sourcep, const char *targetp, const char *fstypep, * everywhere except under /dev where it interferes with device * emulation. */ - if (strcmp(targetp, "/dev") != 0 && - strncmp(targetp, "/dev/", 5) != 0) + if (strcmp(target, "/dev") != 0 && + strncmp(target, "/dev/", 5) != 0) sflags |= MS_OVERLAY; } else if (strcmp(fstype, "proc") == 0) { /* Translate proc mount requests to lx_proc requests. */ @@ -614,7 +617,11 @@ lx_mount(const char *sourcep, const char *targetp, const char *fstypep, VFS_RELE(vfsp); if (strcmp(fstype, "tmpfs") == 0 && (uid != -1 || gid != -1)) { /* Handle tmpfs uid/gid mount options. */ - (void) lx_chown(target, uid, gid); + if (lookupname(target, UIO_SYSSPACE, FOLLOW, NULLVPP, + &vp) == 0) { + (void) lx_vn_chown(vp, (uid_t)uid, (gid_t)gid); + VN_RELE(vp); + } } return (0); |