summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-09-18 17:54:23 -0400
committerTejun Heo <tj@kernel.org>2015-09-18 17:54:23 -0400
commit7dbdb199d3bf88f043ea17e97113eb28d5b100bc (patch)
tree648451cd5f719dafe1c01a18cf2a7903d6166f93 /include/linux
parent4a07c222d3afb00e1113834fee38d23a8e5d71dc (diff)
cgroup: replace cftype->mode with CFTYPE_WORLD_WRITABLE
cftype->mode allows controllers to give arbitrary permissions to interface knobs. Except for "cgroup.event_control", the existing uses are spurious. * Some explicitly specify S_IRUGO | S_IWUSR even though that's the default. * "cpuset.memory_pressure" specifies S_IRUGO while also setting a write callback which returns -EACCES. All it needs to do is simply not setting a write callback. "cgroup.event_control" uses cftype->mode to make the file world-writable. It's a misdesigned interface and we don't want controllers to be tweaking interface file permissions in general. This patch removes cftype->mode and all its spurious uses and implements CFTYPE_WORLD_WRITABLE for "cgroup.event_control" which is marked as compatibility-only. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Li Zefan <lizefan@huawei.com> Cc: Johannes Weiner <hannes@cmpxchg.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/cgroup-defs.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index d95cc88e9dc2..10d814bcd487 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -76,6 +76,7 @@ enum {
76 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */ 76 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */
77 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */ 77 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */
78 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ 78 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */
79 CFTYPE_WORLD_WRITABLE = (1 << 4), /* (DON'T USE FOR NEW FILES) S_IWUGO */
79 80
80 /* internal flags, do not use outside cgroup core proper */ 81 /* internal flags, do not use outside cgroup core proper */
81 __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */ 82 __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */
@@ -324,11 +325,6 @@ struct cftype {
324 */ 325 */
325 char name[MAX_CFTYPE_NAME]; 326 char name[MAX_CFTYPE_NAME];
326 unsigned long private; 327 unsigned long private;
327 /*
328 * If not 0, file mode is set to this value, otherwise it will
329 * be figured out automatically
330 */
331 umode_t mode;
332 328
333 /* 329 /*
334 * The maximum length of string, excluding trailing nul, that can 330 * The maximum length of string, excluding trailing nul, that can