From: Miklos Szeredi <miklos@szeredi.hu>
To: akpm@linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, util-linux-ng@vger.kernel.org
Subject: [patch 8/8] allow unprivileged fuse mounts
Date: Wed, 04 Apr 2007 20:30:20 +0200 [thread overview]
Message-ID: <20070404183106.775407014@szeredi.hu> (raw)
In-Reply-To: 20070404183012.429274832@szeredi.hu
[-- Attachment #1: fuse_safe.patch --]
[-- Type: text/plain, Size: 2469 bytes --]
From: Miklos Szeredi <mszeredi@suse.cz>
Use FS_SAFE for "fuse" fs type, but not for "fuseblk".
FUSE was designed from the beginning to be safe for unprivileged
users. This has also been verified in practice over many years. The
sysadmin still needs to set "fs.max_user_mounts" sysctl variable to a
non-zero value to enable unprivileged mounts.
This will enable future installations to remove the suid-root
fusermount utility.
Don't require the "user_id=" and "group_id=" options for unprivileged
mounts, but if they are present verify them for sanity.
Disallow the "allow_other" option for unprivileged mounts.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
Index: linux/fs/fuse/inode.c
===================================================================
--- linux.orig/fs/fuse/inode.c 2007-04-04 19:29:44.000000000 +0200
+++ linux/fs/fuse/inode.c 2007-04-04 19:30:11.000000000 +0200
@@ -311,6 +311,19 @@ static int parse_fuse_opt(char *opt, str
d->max_read = ~0;
d->blksize = 512;
+ /*
+ * For unprivileged mounts use current uid/gid. Still allow
+ * "user_id" and "group_id" options for compatibility, but
+ * only if they match these values.
+ */
+ if (!capable(CAP_SYS_ADMIN)) {
+ d->user_id = current->uid;
+ d->user_id_present = 1;
+ d->group_id = current->gid;
+ d->group_id_present = 1;
+
+ }
+
while ((p = strsep(&opt, ",")) != NULL) {
int token;
int value;
@@ -339,6 +352,8 @@ static int parse_fuse_opt(char *opt, str
case OPT_USER_ID:
if (match_int(&args[0], &value))
return 0;
+ if (d->user_id_present && d->user_id != value)
+ return 0;
d->user_id = value;
d->user_id_present = 1;
break;
@@ -346,6 +361,8 @@ static int parse_fuse_opt(char *opt, str
case OPT_GROUP_ID:
if (match_int(&args[0], &value))
return 0;
+ if (d->group_id_present && d->group_id != value)
+ return 0;
d->group_id = value;
d->group_id_present = 1;
break;
@@ -536,6 +553,10 @@ static int fuse_fill_super(struct super_
if (!parse_fuse_opt((char *) data, &d, is_bdev))
return -EINVAL;
+ /* This is a privileged option */
+ if ((d.flags & FUSE_ALLOW_OTHER) && !capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if (is_bdev) {
#ifdef CONFIG_BLOCK
if (!sb_set_blocksize(sb, d.blksize))
@@ -639,6 +660,7 @@ static struct file_system_type fuse_fs_t
.fs_flags = FS_HAS_SUBTYPE,
.get_sb = fuse_get_sb,
.kill_sb = kill_anon_super,
+ .fs_flags = FS_SAFE,
};
#ifdef CONFIG_BLOCK
--
next prev parent reply other threads:[~2007-04-04 18:32 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-04 18:30 [patch 0/8] unprivileged mount syscall Miklos Szeredi
2007-04-04 18:30 ` [patch 1/8] add user mounts to the kernel Miklos Szeredi
2007-04-04 18:30 ` [patch 2/8] allow unprivileged umount Miklos Szeredi
2007-04-04 18:30 ` [patch 3/8] account user mounts Miklos Szeredi
2007-04-04 18:30 ` [patch 4/8] propagate error values from clone_mnt Miklos Szeredi
2007-04-04 18:30 ` [patch 5/8] allow unprivileged bind mounts Miklos Szeredi
2007-04-04 18:30 ` [patch 6/8] put declaration of put_filesystem() in fs.h Miklos Szeredi
2007-04-04 18:30 ` [patch 7/8] allow unprivileged mounts Miklos Szeredi
2007-04-04 18:30 ` Miklos Szeredi [this message]
2007-04-09 18:57 ` [patch 0/8] unprivileged mount syscall Serge E. Hallyn
2007-04-09 20:14 ` Miklos Szeredi
2007-04-09 20:55 ` Serge E. Hallyn
[not found] ` <20070409205506.GC20226-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-04-11 19:43 ` Miklos Szeredi
[not found] ` <E1Hbiih-00060L-00-VFwzv6uONVrxNFs70CDYszOMxtEWgIxa@public.gmane.org>
2007-04-11 20:05 ` Serge E. Hallyn
2007-04-11 20:41 ` Miklos Szeredi
2007-04-11 20:57 ` Serge E. Hallyn
[not found] ` <20070404183012.429274832-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org>
2007-04-06 23:02 ` Andrew Morton
2007-04-06 23:16 ` H. Peter Anvin
2007-04-06 23:55 ` Jan Engelhardt
2007-04-07 0:22 ` H. Peter Anvin
2007-04-07 3:40 ` Eric Van Hensbergen
[not found] ` <a4e6962a0704062040q12c0013ek9591b9fbb27caa12-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-04-07 6:48 ` Miklos Szeredi
2007-04-10 8:52 ` Ian Kent
[not found] ` <1176195125.3476.47.camel-J+SFD3YVfrQ/gntp4R1GGQ@public.gmane.org>
2007-04-11 10:48 ` Miklos Szeredi
2007-04-11 13:48 ` Ian Kent
[not found] ` <1176299311.3377.6.camel-J+SFD3YVfrQ/gntp4R1GGQ@public.gmane.org>
2007-04-11 14:26 ` Serge E. Hallyn
[not found] ` <20070411142608.GC30460-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-04-11 14:27 ` Ian Kent
[not found] ` <1176301632.3377.9.camel-J+SFD3YVfrQ/gntp4R1GGQ@public.gmane.org>
2007-04-11 14:45 ` Serge E. Hallyn
2007-04-07 6:41 ` Miklos Szeredi
[not found] ` <E1Ha4cN-0004rc-00-VFwzv6uONVrxNFs70CDYszOMxtEWgIxa@public.gmane.org>
2007-04-09 14:38 ` Serge E. Hallyn
[not found] ` <20070409143802.GB4891-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-04-09 16:24 ` Miklos Szeredi
2007-04-09 17:07 ` Serge E. Hallyn
2007-04-09 17:46 ` Ram Pai
2007-04-09 18:25 ` H. Peter Anvin
2007-04-10 10:33 ` Karel Zak
2007-04-09 20:10 ` Miklos Szeredi
2007-04-10 8:38 ` Ram Pai
2007-04-11 10:44 ` Miklos Szeredi
[not found] ` <E1HbaJV-00059N-00-VFwzv6uONVrxNFs70CDYszOMxtEWgIxa@public.gmane.org>
2007-04-11 18:28 ` Ram Pai
[not found] ` <1176316116.2811.39.camel-kj2lFfaA5cHMbYB6QlFGEg@public.gmane.org>
2007-04-13 11:58 ` Miklos Szeredi
2007-04-13 20:07 ` Karel Zak
[not found] ` <20070413200720.GS31445-CxBs/XhZ2BtHjqfyn1fVYA@public.gmane.org>
2007-04-15 20:21 ` Miklos Szeredi
[not found] ` <E1HcKQd-0001yO-00-VFwzv6uONVrxNFs70CDYszOMxtEWgIxa@public.gmane.org>
2007-04-13 13:28 ` Serge E. Hallyn
2007-04-13 14:05 ` Miklos Szeredi
2007-04-13 21:44 ` Serge E. Hallyn
[not found] ` <20070413214415.GA28629-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-04-15 20:39 ` Miklos Szeredi
[not found] ` <E1HdBVc-0005pL-00-VFwzv6uONVrxNFs70CDYszOMxtEWgIxa@public.gmane.org>
2007-04-16 1:11 ` Serge E. Hallyn
[not found] ` <E1HcMOq-0002As-00-VFwzv6uONVrxNFs70CDYszOMxtEWgIxa@public.gmane.org>
2007-04-16 8:18 ` Ram Pai
[not found] ` <1176711509.9488.4.camel-kj2lFfaA5cHMbYB6QlFGEg@public.gmane.org>
2007-04-16 9:27 ` Miklos Szeredi
2007-04-16 15:40 ` Eric W. Biederman
[not found] ` <m1d524l43w.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org>
2007-04-16 15:55 ` Miklos Szeredi
2007-04-16 7:59 ` Ram Pai
2007-04-09 22:00 ` Serge E. Hallyn
2007-04-11 10:32 ` Miklos Szeredi
-- strict thread matches above, loose matches on Subject: below --
2007-04-20 10:25 [patch 0/8] mount ownership and unprivileged mount syscall (v4) Miklos Szeredi
2007-04-20 10:25 ` [patch 8/8] allow unprivileged fuse mounts Miklos Szeredi
2007-04-21 7:55 ` Andrew Morton
2007-04-21 8:16 ` Miklos Szeredi
2007-04-21 14:18 ` Eric W. Biederman
2007-04-22 7:22 ` Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070404183106.775407014@szeredi.hu \
--to=miklos@szeredi.hu \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=util-linux-ng@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox