]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.20.2/fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 2.6.20.2 / fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls.patch
CommitLineData
95c21306
GKH
1From stable-bounces@linux.kernel.org Fri Feb 23 13:55:02 2007
2From: Hugh Dickins <hugh@veritas.com>
3Date: Fri, 23 Feb 2007 21:53:49 +0000 (GMT)
4Subject: fix umask when noACL kernel meets extN tuned for ACLs
5To: Greg KH <greg@kroah.com>
6Cc: Chris Wright <chrisw@sous-sol.org>, Tigran Aivazian <tigran@aivazian.fsnet.co.uk>, stable@kernel.org, Andreas Gruenbacher <agruen@suse.de>
7Message-ID: <Pine.LNX.4.64.0702232152330.11377@blonde.wat.veritas.com>
8
9From: Hugh Dickins <hugh@veritas.com>
10
11Fix insecure default behaviour reported by Tigran Aivazian: if an ext2
12or ext3 or ext4 filesystem is tuned to mount with "acl", but mounted by
13a kernel built without ACL support, then umask was ignored when creating
14inodes - though root or user has umask 022, touch creates files as 0666,
15and mkdir creates directories as 0777.
16
17This appears to have worked right until 2.6.11, when a fix to the default
18mode on symlinks (always 0777) assumed VFS applies umask: which it does,
19unless the mount is marked for ACLs; but ext[234] set MS_POSIXACL in
20s_flags according to s_mount_opt set according to def_mount_opts.
21
22We could revert to the 2.6.10 ext[234]_init_acl (adding an S_ISLNK test);
23but other filesystems only set MS_POSIXACL when ACLs are configured. We
24could fix this at another level; but it seems most robust to avoid setting
25the s_mount_opt flag in the first place (at the expense of more ifdefs).
26
27Likewise don't set the XATTR_USER flag when built without XATTR support.
28
29Signed-off-by: Hugh Dickins <hugh@veritas.com>
30Acked-by: Andreas Gruenbacher <agruen@suse.de>
31Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
32Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
33
34---
35 fs/ext2/super.c | 4 ++++
36 fs/ext3/super.c | 4 ++++
37 fs/ext4/super.c | 4 ++++
38 3 files changed, 12 insertions(+)
39
40--- linux-2.6.20.1.orig/fs/ext2/super.c
41+++ linux-2.6.20.1/fs/ext2/super.c
42@@ -708,10 +708,14 @@ static int ext2_fill_super(struct super_
43 set_opt(sbi->s_mount_opt, GRPID);
44 if (def_mount_opts & EXT2_DEFM_UID16)
45 set_opt(sbi->s_mount_opt, NO_UID32);
46+#ifdef CONFIG_EXT2_FS_XATTR
47 if (def_mount_opts & EXT2_DEFM_XATTR_USER)
48 set_opt(sbi->s_mount_opt, XATTR_USER);
49+#endif
50+#ifdef CONFIG_EXT2_FS_POSIX_ACL
51 if (def_mount_opts & EXT2_DEFM_ACL)
52 set_opt(sbi->s_mount_opt, POSIX_ACL);
53+#endif
54
55 if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC)
56 set_opt(sbi->s_mount_opt, ERRORS_PANIC);
57--- linux-2.6.20.1.orig/fs/ext3/super.c
58+++ linux-2.6.20.1/fs/ext3/super.c
59@@ -1459,10 +1459,14 @@ static int ext3_fill_super (struct super
60 set_opt(sbi->s_mount_opt, GRPID);
61 if (def_mount_opts & EXT3_DEFM_UID16)
62 set_opt(sbi->s_mount_opt, NO_UID32);
63+#ifdef CONFIG_EXT3_FS_XATTR
64 if (def_mount_opts & EXT3_DEFM_XATTR_USER)
65 set_opt(sbi->s_mount_opt, XATTR_USER);
66+#endif
67+#ifdef CONFIG_EXT3_FS_POSIX_ACL
68 if (def_mount_opts & EXT3_DEFM_ACL)
69 set_opt(sbi->s_mount_opt, POSIX_ACL);
70+#endif
71 if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_DATA)
72 sbi->s_mount_opt |= EXT3_MOUNT_JOURNAL_DATA;
73 else if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_ORDERED)
74--- linux-2.6.20.1.orig/fs/ext4/super.c
75+++ linux-2.6.20.1/fs/ext4/super.c
76@@ -1518,10 +1518,14 @@ static int ext4_fill_super (struct super
77 set_opt(sbi->s_mount_opt, GRPID);
78 if (def_mount_opts & EXT4_DEFM_UID16)
79 set_opt(sbi->s_mount_opt, NO_UID32);
80+#ifdef CONFIG_EXT4DEV_FS_XATTR
81 if (def_mount_opts & EXT4_DEFM_XATTR_USER)
82 set_opt(sbi->s_mount_opt, XATTR_USER);
83+#endif
84+#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL
85 if (def_mount_opts & EXT4_DEFM_ACL)
86 set_opt(sbi->s_mount_opt, POSIX_ACL);
87+#endif
88 if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)
89 sbi->s_mount_opt |= EXT4_MOUNT_JOURNAL_DATA;
90 else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED)