Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:3.12 commit in: /
Date: Wed, 25 Jun 2014 17:20:24
Message-Id: 1403716794.0f0f9f5f08c096bf62e0898c51ec3c3b3960eeaf.mpagano@gentoo
1 commit: 0f0f9f5f08c096bf62e0898c51ec3c3b3960eeaf
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 25 17:19:54 2014 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 25 17:19:54 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=0f0f9f5f
7
8 Remove redundant patch.
9
10 ---
11 0000_README | 4 -
12 ...inode_capable-to-capable_wrt_inode_uidgid.patch | 160 ---------------------
13 2 files changed, 164 deletions(-)
14
15 diff --git a/0000_README b/0000_README
16 index b0d0097..c37d7ee 100644
17 --- a/0000_README
18 +++ b/0000_README
19 @@ -166,10 +166,6 @@ Patch: 4200_fbcondecor-0.9.6.patch
20 From: http://dev.gentoo.org/~spock
21 Desc: Bootsplash successor by Michal Januszewski ported by Jeremy (bug #452574)
22
23 -Patch: 4400_fs-userns-change-inode_capable-to-capable_wrt_inode_uidgid.patch
24 -From: https://bugs.gentoo.org/show_bug.cgi?id=512980
25 -Desc: Change inode_capable to capable_wrt_inode_uidgid, fixes CVE-2014-4014
26 -
27 Patch: 4500_support-for-pogoplug-e02.patch
28 From: Cristoph Junghans <ottxor@g.o>
29 Desc: Support for Pogoplug e02 (bug #460350), adjusted to be opt-in by TomWij.
30
31 diff --git a/4400_fs-userns-change-inode_capable-to-capable_wrt_inode_uidgid.patch b/4400_fs-userns-change-inode_capable-to-capable_wrt_inode_uidgid.patch
32 deleted file mode 100644
33 index 108309d..0000000
34 --- a/4400_fs-userns-change-inode_capable-to-capable_wrt_inode_uidgid.patch
35 +++ /dev/null
36 @@ -1,160 +0,0 @@
37 ---- a/fs/attr.c 2014-06-11 19:56:10.729668444 -0400
38 -+++ b/fs/attr.c 2014-06-11 20:19:09.719657538 -0400
39 -@@ -50,14 +50,14 @@ int inode_change_ok(const struct inode *
40 - if ((ia_valid & ATTR_UID) &&
41 - (!uid_eq(current_fsuid(), inode->i_uid) ||
42 - !uid_eq(attr->ia_uid, inode->i_uid)) &&
43 -- !inode_capable(inode, CAP_CHOWN))
44 -+ !capable_wrt_inode_uidgid(inode, CAP_CHOWN))
45 - return -EPERM;
46 -
47 - /* Make sure caller can chgrp. */
48 - if ((ia_valid & ATTR_GID) &&
49 - (!uid_eq(current_fsuid(), inode->i_uid) ||
50 - (!in_group_p(attr->ia_gid) && !gid_eq(attr->ia_gid, inode->i_gid))) &&
51 -- !inode_capable(inode, CAP_CHOWN))
52 -+ !capable_wrt_inode_uidgid(inode, CAP_CHOWN))
53 - return -EPERM;
54 -
55 - /* Make sure a caller can chmod. */
56 -@@ -67,7 +67,7 @@ int inode_change_ok(const struct inode *
57 - /* Also check the setgid bit! */
58 - if (!in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid :
59 - inode->i_gid) &&
60 -- !inode_capable(inode, CAP_FSETID))
61 -+ !capable_wrt_inode_uidgid(inode, CAP_FSETID))
62 - attr->ia_mode &= ~S_ISGID;
63 - }
64 -
65 -@@ -160,7 +160,7 @@ void setattr_copy(struct inode *inode, c
66 - umode_t mode = attr->ia_mode;
67 -
68 - if (!in_group_p(inode->i_gid) &&
69 -- !inode_capable(inode, CAP_FSETID))
70 -+ !capable_wrt_inode_uidgid(inode, CAP_FSETID))
71 - mode &= ~S_ISGID;
72 - inode->i_mode = mode;
73 - }
74 ---- a/fs/inode.c 2014-06-11 19:56:23.489668343 -0400
75 -+++ b/fs/inode.c 2014-06-11 20:06:19.049663633 -0400
76 -@@ -1840,14 +1840,18 @@ EXPORT_SYMBOL(inode_init_owner);
77 - * inode_owner_or_capable - check current task permissions to inode
78 - * @inode: inode being checked
79 - *
80 -- * Return true if current either has CAP_FOWNER to the inode, or
81 -- * owns the file.
82 -+ * Return true if current either has CAP_FOWNER in a namespace with the
83 -+ * inode owner uid mapped, or owns the file
84 - */
85 - bool inode_owner_or_capable(const struct inode *inode)
86 - {
87 -+ struct user_namespace *ns;
88 -+
89 - if (uid_eq(current_fsuid(), inode->i_uid))
90 - return true;
91 -- if (inode_capable(inode, CAP_FOWNER))
92 -+
93 -+ ns = current_user_ns();
94 -+ if (ns_capable(ns, CAP_FOWNER) && kuid_has_mapping(ns, inode->i_uid))
95 - return true;
96 - return false;
97 - }
98 ---- a/fs/namei.c 2014-06-11 19:56:33.039668268 -0400
99 -+++ b/fs/namei.c 2014-06-11 20:10:37.189661592 -0400
100 -@@ -332,10 +332,11 @@ int generic_permission(struct inode *ino
101 -
102 - if (S_ISDIR(inode->i_mode)) {
103 - /* DACs are overridable for directories */
104 -- if (inode_capable(inode, CAP_DAC_OVERRIDE))
105 -+ if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE))
106 - return 0;
107 - if (!(mask & MAY_WRITE))
108 -- if (inode_capable(inode, CAP_DAC_READ_SEARCH))
109 -+ if (capable_wrt_inode_uidgid(inode,
110 -+ CAP_DAC_READ_SEARCH))
111 - return 0;
112 - return -EACCES;
113 - }
114 -@@ -345,7 +346,7 @@ int generic_permission(struct inode *ino
115 - * at least one exec bit set.
116 - */
117 - if (!(mask & MAY_EXEC) || (inode->i_mode & S_IXUGO))
118 -- if (inode_capable(inode, CAP_DAC_OVERRIDE))
119 -+ if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE))
120 - return 0;
121 -
122 - /*
123 -@@ -353,7 +354,7 @@ int generic_permission(struct inode *ino
124 - */
125 - mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
126 - if (mask == MAY_READ)
127 -- if (inode_capable(inode, CAP_DAC_READ_SEARCH))
128 -+ if (capable_wrt_inode_uidgid(inode, CAP_DAC_READ_SEARCH))
129 - return 0;
130 -
131 - return -EACCES;
132 -@@ -2370,7 +2371,7 @@ static inline int check_sticky(struct in
133 - return 0;
134 - if (uid_eq(dir->i_uid, fsuid))
135 - return 0;
136 -- return !inode_capable(inode, CAP_FOWNER);
137 -+ return !capable_wrt_inode_uidgid(inode, CAP_FOWNER);
138 - }
139 -
140 - /*
141 ---- a/fs/xfs/xfs_ioctl.c 2014-06-11 19:57:03.309668028 -0400
142 -+++ b/fs/xfs/xfs_ioctl.c 2014-06-11 20:11:15.719661287 -0400
143 -@@ -1241,7 +1241,7 @@ xfs_ioctl_setattr(
144 - * cleared upon successful return from chown()
145 - */
146 - if ((ip->i_d.di_mode & (S_ISUID|S_ISGID)) &&
147 -- !inode_capable(VFS_I(ip), CAP_FSETID))
148 -+ !capable_wrt_inode_uidgid(VFS_I(ip), CAP_FSETID))
149 - ip->i_d.di_mode &= ~(S_ISUID|S_ISGID);
150 -
151 - /*
152 ---- a/include/linux/capability.h 2014-06-11 19:57:21.319667886 -0400
153 -+++ b/include/linux/capability.h 2014-06-11 20:11:52.129660999 -0400
154 -@@ -210,7 +210,7 @@ extern bool has_ns_capability_noaudit(st
155 - struct user_namespace *ns, int cap);
156 - extern bool capable(int cap);
157 - extern bool ns_capable(struct user_namespace *ns, int cap);
158 --extern bool inode_capable(const struct inode *inode, int cap);
159 -+extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap);
160 - extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
161 -
162 - /* audit system wants to get cap info from files as well */
163 ---- a/kernel/capability.c 2014-06-11 20:00:58.389666169 -0400
164 -+++ b/kernel/capability.c 2014-06-11 20:13:46.629660094 -0400
165 -@@ -433,23 +433,19 @@ bool capable(int cap)
166 - EXPORT_SYMBOL(capable);
167 -
168 - /**
169 -- * inode_capable - Check superior capability over inode
170 -+ * capable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped
171 - * @inode: The inode in question
172 - * @cap: The capability in question
173 - *
174 -- * Return true if the current task has the given superior capability
175 -- * targeted at it's own user namespace and that the given inode is owned
176 -- * by the current user namespace or a child namespace.
177 -- *
178 -- * Currently we check to see if an inode is owned by the current
179 -- * user namespace by seeing if the inode's owner maps into the
180 -- * current user namespace.
181 -- *
182 -+ * Return true if the current task has the given capability targeted at
183 -+ * its own user namespace and that the given inode's uid and gid are
184 -+ * mapped into the current user namespace
185 - */
186 --bool inode_capable(const struct inode *inode, int cap)
187 -+bool capable_wrt_inode_uidgid(const struct inode *inode, int cap)
188 - {
189 - struct user_namespace *ns = current_user_ns();
190 -
191 -- return ns_capable(ns, cap) && kuid_has_mapping(ns, inode->i_uid);
192 -+ return ns_capable(ns, cap) && kuid_has_mapping(ns, inode->i_uid) &&
193 -+ kgid_has_mapping(ns, inode->i_gid);
194 - }
195 --EXPORT_SYMBOL(inode_capable);
196 -+EXPORT_SYMBOL(capable_wrt_inode_uidgid);