diff mbox

ext4: enable acls and user_xattr by default

Message ID 4D5ED705.7010902@redhat.com
State Accepted, archived
Headers show

Commit Message

Eric Sandeen Feb. 18, 2011, 8:31 p.m. UTC
There's no good reason to require the extra step of providing
a mount option for acl or user_xattr once the feature is configured
on; no other filesystem that I know of requires this.

Userspace patches have set these options in default mount options,
and this patch makes them default in the kernel.  At some point
we can start to deprecate the options, perhaps.

For now I've removed default mount option checks in show_options()
to be explicit about what's set, since it's changing the default,
but I'm open to alternatives if desired.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

p.s. I've got ext2 & ext3 patches too - Jan, is this ok with
you for ext2/3 as well?


index 48ce561..77dec05 100644
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jan Kara Feb. 21, 2011, 1:46 p.m. UTC | #1
Hi Eric,

On Fri 18-02-11 14:31:01, Eric Sandeen wrote:
> There's no good reason to require the extra step of providing
> a mount option for acl or user_xattr once the feature is configured
> on; no other filesystem that I know of requires this.
> 
> Userspace patches have set these options in default mount options,
> and this patch makes them default in the kernel.  At some point
> we can start to deprecate the options, perhaps.
> 
> For now I've removed default mount option checks in show_options()
> to be explicit about what's set, since it's changing the default,
> but I'm open to alternatives if desired.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> p.s. I've got ext2 & ext3 patches too - Jan, is this ok with
> you for ext2/3 as well?
  I was thinking about this for a while. I definitely agree with the change
of default mount options in e2fsprogs (so that user_xattr and acl will be
turned on by default). But after such change is there really any bigger
point in changing the kernel defaults? Users won't have to specify options
for new filesystems because of new default mount options setting (so the
change does not bring any simplification) and for old filesystems the admin
has proper options in /etc/fstab and if not perhaps he didn't want e.g.
user_xattr to be supported so suddently turning the support on with newer
kernel will confuse them)?

So if we wanted to do such a transition for consistency with other
filesystems, we should maybe first start warning that people should use
nouser_xattr and noacl when they really didn't want them?

								Honza
Eric Sandeen Feb. 21, 2011, 5:10 p.m. UTC | #2
On 2/21/11 7:46 AM, Jan Kara wrote:
>   Hi Eric,
> 
> On Fri 18-02-11 14:31:01, Eric Sandeen wrote:
>> There's no good reason to require the extra step of providing
>> a mount option for acl or user_xattr once the feature is configured
>> on; no other filesystem that I know of requires this.
>>
>> Userspace patches have set these options in default mount options,
>> and this patch makes them default in the kernel.  At some point
>> we can start to deprecate the options, perhaps.
>>
>> For now I've removed default mount option checks in show_options()
>> to be explicit about what's set, since it's changing the default,
>> but I'm open to alternatives if desired.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>> p.s. I've got ext2 & ext3 patches too - Jan, is this ok with
>> you for ext2/3 as well?
>   I was thinking about this for a while. I definitely agree with the change
> of default mount options in e2fsprogs (so that user_xattr and acl will be
> turned on by default). But after such change is there really any bigger
> point in changing the kernel defaults? Users won't have to specify options
> for new filesystems because of new default mount options setting (so the
> change does not bring any simplification) and for old filesystems the admin
> has proper options in /etc/fstab and if not perhaps he didn't want e.g.
> user_xattr to be supported so suddently turning the support on with newer
> kernel will confuse them)?

Well, I did this initially because Ted & Andreas seemed to want it ;)

I think the idea is, we should move to deprecating and removing the options
altogether.  Is there any advantage to having them?  And the first step
to deprecating them might be to change the default.

It does seem a little odd to now have the default one way in userspace,
and another way in the kernel.

But I'm OK either way, to be honest.  Userspace alone solves my "Fedora
Problem" but it leaves the kernel as kind of an oddball.

-Eric

> So if we wanted to do such a transition for consistency with other
> filesystems, we should maybe first start warning that people should use
> nouser_xattr and noacl when they really didn't want them?


 
> 								Honza

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o Feb. 23, 2011, 5:31 p.m. UTC | #3
On Mon, Feb 21, 2011 at 11:10:16AM -0600, Eric Sandeen wrote:
> 
> Well, I did this initially because Ted & Andreas seemed to want it ;)
> 
> I think the idea is, we should move to deprecating and removing the options
> altogether.  Is there any advantage to having them?  And the first step
> to deprecating them might be to change the default.

Yeah, part of the whole goal is to reduce the number of mount options,
since they have really gotten out of control.  Each mount option is
another adds more to the test combinatorics nightmare.

So basically, the question is how much value does the mount option
add?  In fact changing acl's on and off can in fact cause surprises,
since the posix acl's are designed to be safe when going from the
noacl->acl case.  That is, the additional information in the posix
acl's are designed to take away rights, but not add access rights.
But that also means that if you have a file system that had ACL's to
restrict access rights, and then you mount it without using the acl
option, users who aren't supposed to have access to the file might
find themselves with access.

So changing things to have acl's on by default just seems to make
sense....

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o Feb. 23, 2011, 10:51 p.m. UTC | #4
On Fri, Feb 18, 2011 at 02:31:01PM -0600, Eric Sandeen wrote:
> There's no good reason to require the extra step of providing
> a mount option for acl or user_xattr once the feature is configured
> on; no other filesystem that I know of requires this.
> 
> Userspace patches have set these options in default mount options,
> and this patch makes them default in the kernel.  At some point
> we can start to deprecate the options, perhaps.
> 
> For now I've removed default mount option checks in show_options()
> to be explicit about what's set, since it's changing the default,
> but I'm open to alternatives if desired.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Added to the ext4 patch queue, thanks!!

				- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Kara Feb. 24, 2011, 11:49 a.m. UTC | #5
On Wed 23-02-11 12:31:52, Ted Ts'o wrote:
> On Mon, Feb 21, 2011 at 11:10:16AM -0600, Eric Sandeen wrote:
> > 
> > Well, I did this initially because Ted & Andreas seemed to want it ;)
> > 
> > I think the idea is, we should move to deprecating and removing the options
> > altogether.  Is there any advantage to having them?  And the first step
> > to deprecating them might be to change the default.
> 
> Yeah, part of the whole goal is to reduce the number of mount options,
> since they have really gotten out of control.  Each mount option is
> another adds more to the test combinatorics nightmare.
  Yes, I definitely agree with this.

> So basically, the question is how much value does the mount option
> add?  In fact changing acl's on and off can in fact cause surprises,
> since the posix acl's are designed to be safe when going from the
> noacl->acl case.  That is, the additional information in the posix
> acl's are designed to take away rights, but not add access rights.
  I agree it may cause surprises although it's not true that ACL's remove
rights. Rather on contrary ACL's can only give additional rights (i.e. you
have 600 file + user foo can also read it) thus noacl->acl transition might
be insecure if you have some old unwanted ACL's pending.

> But that also means that if you have a file system that had ACL's to
> restrict access rights, and then you mount it without using the acl
> option, users who aren't supposed to have access to the file might
> find themselves with access.
  As I write above it's the other way around but that's not a point I would
be afraid about. It's more that admins might run without user_xattr and
ACL's e.g. because their arguably stupid audit app is not able to handle
them properly. Suddenly they become enabled because of the kernel change,
users, can set them, and later the admin finds things are broken. So I'd
at least warn that the default is changing if (no)acl,(no)user_xattr
options are not used during mount.

								Honza
Theodore Ts'o Feb. 24, 2011, 12:19 p.m. UTC | #6
On Feb 24, 2011, at 6:49 AM, Jan Kara wrote:

>  I agree it may cause surprises although it's not true that ACL's remove
> rights. Rather on contrary ACL's can only give additional rights (i.e. you
> have 600 file + user foo can also read it) thus noacl->acl transition might
> be insecure if you have some old unwanted ACL's pending.

My understanding of how POSIX acls work is that the if you want to give
read access to user "foo" (where "foo" is not the user) is you first have to 
open up the file permissions to do the equivalent of "o+r".

See: http://acl.bestbits.at/man/man5/acl.txt

And then note how ACL_MASK corresponds to the permissions bits...

-- Ted

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Kara Feb. 24, 2011, 1:57 p.m. UTC | #7
On Thu 24-02-11 07:19:46, Theodore Tso wrote:
> 
> On Feb 24, 2011, at 6:49 AM, Jan Kara wrote:
> 
> >  I agree it may cause surprises although it's not true that ACL's remove
> > rights. Rather on contrary ACL's can only give additional rights (i.e. you
> > have 600 file + user foo can also read it) thus noacl->acl transition might
> > be insecure if you have some old unwanted ACL's pending.
> 
> My understanding of how POSIX acls work is that the if you want to give
> read access to user "foo" (where "foo" is not the user) is you first have to 
> open up the file permissions to do the equivalent of "o+r".
  I've actually tried that before posting my email and it's not like that.
I did:
jack@quack:~/source> echo 'aaa' >/tmp/f
jack@quack:~/source> chmod 600 /tmp/f
jack@quack:~/source> setfacl -m u:nobody:rw /tmp/f
jack@quack:~/source> sudo su nobody -c "cat /tmp/f"
aaa
jack@quack:~/source> sudo su news -c "cat /tmp/f"
cat: /tmp/f: Permission denied

> See: http://acl.bestbits.at/man/man5/acl.txt
> 
> And then note how ACL_MASK corresponds to the permissions bits...
  OK, I see but then look at setfactl(1), commentary of -n option:
The default  behavior of  setfacl  is  to  recalculate  the ACL mask entry,
unless a mask entry was explicitly given.  The mask entry is set to the
union of all  permissions  of the owning group, and all named user and
group entries. (These are  exactly  the  entries  affected  by  the mask
entry).

  So setfacl(1) by default makes the mask logic void.

								Honza
Theodore Ts'o Feb. 24, 2011, 4:49 p.m. UTC | #8
On Thu, Feb 24, 2011 at 02:57:40PM +0100, Jan Kara wrote:
>   I've actually tried that before posting my email and it's not like that.
> I did:
> jack@quack:~/source> echo 'aaa' >/tmp/f
> jack@quack:~/source> chmod 600 /tmp/f
> jack@quack:~/source> setfacl -m u:nobody:rw /tmp/f
> jack@quack:~/source> sudo su nobody -c "cat /tmp/f"
> aaa
> jack@quack:~/source> sudo su news -c "cat /tmp/f"
> cat: /tmp/f: Permission denied

Hmm... yes, but it's a bit more complicated.  Look at this, and note
how remounting the file system without acl's gave the group "users" rw
access to the file /mnt/f.

						- Ted

<tytso.root@tytso-glaptop> {/}  
2100# mount -o acl /dev/funarg/test /mnt
<tytso.root@tytso-glaptop> {/}  
2101# echo aaa > /mnt/f
<tytso.root@tytso-glaptop> {/}  
2102# chown root:users /mnt/f
<tytso.root@tytso-glaptop> {/}  
2103# chmod 400 /mnt/f
<tytso.root@tytso-glaptop> {/}  
2104# ls -l /mnt/f
4 -r-------- 1 root users 4 Feb 24 11:46 /mnt/f
<tytso.root@tytso-glaptop> {/}  
2105# setfacl -m u:tytso:rw /mnt/f
<tytso.root@tytso-glaptop> {/}  
2106# getfacl /mnt/f
getfacl: Removing leading '/' from absolute path names
# file: mnt/f
# owner: root
# group: users
user::r--
user:tytso:rw-
group::---
mask::rw-
other::---

<tytso.root@tytso-glaptop> {/}  
2107# ls -l /mnt/f
8 -r--rw----+ 1 root users 4 Feb 24 11:46 /mnt/f
<tytso.root@tytso-glaptop> {/}  
2108# umount /mnt
<tytso.root@tytso-glaptop> {/}  
2109# mount -o noacl /dev/funarg/test /mnt
<tytso.root@tytso-glaptop> {/}  
2110# ls -l /mnt/f
8 -r--rw---- 1 root users 4 Feb 24 11:46 /mnt/f



--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Kara Feb. 24, 2011, 6:31 p.m. UTC | #9
On Thu 24-02-11 11:49:13, Ted Ts'o wrote:
> On Thu, Feb 24, 2011 at 02:57:40PM +0100, Jan Kara wrote:
> >   I've actually tried that before posting my email and it's not like that.
> > I did:
> > jack@quack:~/source> echo 'aaa' >/tmp/f
> > jack@quack:~/source> chmod 600 /tmp/f
> > jack@quack:~/source> setfacl -m u:nobody:rw /tmp/f
> > jack@quack:~/source> sudo su nobody -c "cat /tmp/f"
> > aaa
> > jack@quack:~/source> sudo su news -c "cat /tmp/f"
> > cat: /tmp/f: Permission denied
> 
> Hmm... yes, but it's a bit more complicated.  Look at this, and note
> how remounting the file system without acl's gave the group "users" rw
> access to the file /mnt/f.
  Ah OK, I see. So it's both ways ;)

								Honza
diff mbox

Patch

--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -995,13 +995,10 @@  static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
 	if (test_opt(sb, OLDALLOC))
 		seq_puts(seq, ",oldalloc");
 #ifdef CONFIG_EXT4_FS_XATTR
-	if (test_opt(sb, XATTR_USER) &&
-		!(def_mount_opts & EXT4_DEFM_XATTR_USER))
+	if (test_opt(sb, XATTR_USER))
 		seq_puts(seq, ",user_xattr");
-	if (!test_opt(sb, XATTR_USER) &&
-	    (def_mount_opts & EXT4_DEFM_XATTR_USER)) {
+	if (!test_opt(sb, XATTR_USER))
 		seq_puts(seq, ",nouser_xattr");
-	}
 #endif
 #ifdef CONFIG_EXT4_FS_POSIX_ACL
 	if (test_opt(sb, POSIX_ACL) && !(def_mount_opts & EXT4_DEFM_ACL))
@@ -3093,13 +3090,12 @@  static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 	}
 	if (def_mount_opts & EXT4_DEFM_UID16)
 		set_opt(sb, NO_UID32);
+	/* xattr user namespace & acls are now defaulted on */
 #ifdef CONFIG_EXT4_FS_XATTR
-	if (def_mount_opts & EXT4_DEFM_XATTR_USER)
-		set_opt(sb, XATTR_USER);
+	set_opt(sb, XATTR_USER);
 #endif
 #ifdef CONFIG_EXT4_FS_POSIX_ACL
-	if (def_mount_opts & EXT4_DEFM_ACL)
-		set_opt(sb, POSIX_ACL);
+	set_opt(sb, POSIX_ACL);
 #endif
 	if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)
 		set_opt(sb, JOURNAL_DATA);