<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/fs/kernfs, branch v3.15-rc8</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>kernfs, sysfs, cgroup: restrict extra perm check on open to sysfs</title>
<updated>2014-05-13T11:21:40+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2014-05-12T17:56:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=555724a831b4a146e7bdf16ecc989cda032b076d'/>
<id>555724a831b4a146e7bdf16ecc989cda032b076d</id>
<content type='text'>
The kernfs open method - kernfs_fop_open() - inherited extra
permission checks from sysfs.  While the vfs layer allows ignoring the
read/write permissions checks if the issuer has CAP_DAC_OVERRIDE,
sysfs explicitly denied open regardless of the cap if the file doesn't
have any of the UGO perms of the requested access or doesn't implement
the requested operation.  It can be debated whether this was a good
idea or not but the behavior is too subtle and dangerous to change at
this point.

After cgroup got converted to kernfs, this extra perm check also got
applied to cgroup breaking libcgroup which opens write-only files with
O_RDWR as root.  This patch gates the extra open permission check with
a new flag KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK and enables it for sysfs.
For sysfs, nothing changes.  For cgroup, root now can perform any
operation regardless of the permissions as it was before kernfs
conversion.  Note that kernfs still fails unimplemented operations
with -EINVAL.

While at it, add comments explaining KERNFS_ROOT flags.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Andrey Wagin &lt;avagin@gmail.com&gt;
Tested-by: Andrey Wagin &lt;avagin@gmail.com&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
References: http://lkml.kernel.org/g/CANaxB-xUm3rJ-Cbp72q-rQJO5mZe1qK6qXsQM=vh0U8upJ44+A@mail.gmail.com
Fixes: 2bd59d48ebfb ("cgroup: convert to kernfs")
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The kernfs open method - kernfs_fop_open() - inherited extra
permission checks from sysfs.  While the vfs layer allows ignoring the
read/write permissions checks if the issuer has CAP_DAC_OVERRIDE,
sysfs explicitly denied open regardless of the cap if the file doesn't
have any of the UGO perms of the requested access or doesn't implement
the requested operation.  It can be debated whether this was a good
idea or not but the behavior is too subtle and dangerous to change at
this point.

After cgroup got converted to kernfs, this extra perm check also got
applied to cgroup breaking libcgroup which opens write-only files with
O_RDWR as root.  This patch gates the extra open permission check with
a new flag KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK and enables it for sysfs.
For sysfs, nothing changes.  For cgroup, root now can perform any
operation regardless of the permissions as it was before kernfs
conversion.  Note that kernfs still fails unimplemented operations
with -EINVAL.

While at it, add comments explaining KERNFS_ROOT flags.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Andrey Wagin &lt;avagin@gmail.com&gt;
Tested-by: Andrey Wagin &lt;avagin@gmail.com&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
References: http://lkml.kernel.org/g/CANaxB-xUm3rJ-Cbp72q-rQJO5mZe1qK6qXsQM=vh0U8upJ44+A@mail.gmail.com
Fixes: 2bd59d48ebfb ("cgroup: convert to kernfs")
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kernfs: add back missing error check in kernfs_fop_mmap()</title>
<updated>2014-04-25T19:25:13+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2014-04-20T12:29:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b44b2140265ddfde03acbe809336111d31adb0d1'/>
<id>b44b2140265ddfde03acbe809336111d31adb0d1</id>
<content type='text'>
While updating how mmap enabled kernfs files are handled by lockdep,
9b2db6e18945 ("sysfs: bail early from kernfs_file_mmap() to avoid
spurious lockdep warning") inadvertently dropped error return check
from kernfs_file_mmap().  The intention was just dropping "if
(ops-&gt;mmap)" check as the control won't reach the point if the mmap
callback isn't implemented, but I mistakenly removed the error return
check together with it.

This led to Xorg crash on i810 which was reported and bisected to the
commit and then to the specific change by Tobias.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-and-bisected-by: Tobias Powalowski &lt;tobias.powalowski@googlemail.com&gt;
Tested-by: Tobias Powalowski &lt;tobias.powalowski@googlemail.com&gt;
References: http://lkml.kernel.org/g/533D01BD.1010200@googlemail.com
Cc: stable &lt;stable@vger.kernel.org&gt; # 3.14
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While updating how mmap enabled kernfs files are handled by lockdep,
9b2db6e18945 ("sysfs: bail early from kernfs_file_mmap() to avoid
spurious lockdep warning") inadvertently dropped error return check
from kernfs_file_mmap().  The intention was just dropping "if
(ops-&gt;mmap)" check as the control won't reach the point if the mmap
callback isn't implemented, but I mistakenly removed the error return
check together with it.

This led to Xorg crash on i810 which was reported and bisected to the
commit and then to the specific change by Tobias.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-and-bisected-by: Tobias Powalowski &lt;tobias.powalowski@googlemail.com&gt;
Tested-by: Tobias Powalowski &lt;tobias.powalowski@googlemail.com&gt;
References: http://lkml.kernel.org/g/533D01BD.1010200@googlemail.com
Cc: stable &lt;stable@vger.kernel.org&gt; # 3.14
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kernfs: fix a subdir count leak</title>
<updated>2014-04-25T19:25:13+00:00</updated>
<author>
<name>Jianyu Zhan</name>
<email>nasa4836@gmail.com</email>
</author>
<published>2014-04-17T09:52:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c1befb885939cdaaf420c10bbe9ff57aa00446ea'/>
<id>c1befb885939cdaaf420c10bbe9ff57aa00446ea</id>
<content type='text'>
Currently kernfs_link_sibling() increates parent-&gt;dir.subdirs before
adding the node into parent's chidren rb tree.

Because it is possible that kernfs_link_sibling() couldn't find
a suitable slot and bail out, this leads to a mismatch between
elevated subdir count with actual children node numbers.

This patches fix this problem, by moving the subdir accouting
after the actual addtion happening.

Signed-off-by: Jianyu Zhan &lt;nasa4836@gmail.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently kernfs_link_sibling() increates parent-&gt;dir.subdirs before
adding the node into parent's chidren rb tree.

Because it is possible that kernfs_link_sibling() couldn't find
a suitable slot and bail out, this leads to a mismatch between
elevated subdir count with actual children node numbers.

This patches fix this problem, by moving the subdir accouting
after the actual addtion happening.

Signed-off-by: Jianyu Zhan &lt;nasa4836@gmail.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kernfs: protect lazy kernfs_iattrs allocation with mutex</title>
<updated>2014-04-16T18:54:40+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2014-04-02T20:40:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4afddd60a770560d370d6f85c5aef57c16bf7502'/>
<id>4afddd60a770560d370d6f85c5aef57c16bf7502</id>
<content type='text'>
kernfs_iattrs is allocated lazily when operations which require it
take place; unfortunately, the lazy allocation and returning weren't
properly synchronized and when there are multiple concurrent
operations, it might end up returning kernfs_iattrs which hasn't
finished initialization yet or different copies to different callers.

Fix it by synchronizing with a mutex.  This can be smarter with memory
barriers but let's go there if it actually turns out to be necessary.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Link: http://lkml.kernel.org/g/533ABA32.9080602@oracle.com
Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Cc: stable@vger.kernel.org # 3.14
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
kernfs_iattrs is allocated lazily when operations which require it
take place; unfortunately, the lazy allocation and returning weren't
properly synchronized and when there are multiple concurrent
operations, it might end up returning kernfs_iattrs which hasn't
finished initialization yet or different copies to different callers.

Fix it by synchronizing with a mutex.  This can be smarter with memory
barriers but let's go there if it actually turns out to be necessary.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Link: http://lkml.kernel.org/g/533ABA32.9080602@oracle.com
Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Cc: stable@vger.kernel.org # 3.14
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'akpm' (incoming from Andrew)</title>
<updated>2014-04-03T23:22:16+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2014-04-03T23:22:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=76ca7d1cca761bb9712dfcad9a27d70b520874ae'/>
<id>76ca7d1cca761bb9712dfcad9a27d70b520874ae</id>
<content type='text'>
Merge first patch-bomb from Andrew Morton:
 - Various misc bits
 - kmemleak fixes
 - small befs, codafs, cifs, efs, freexxfs, hfsplus, minixfs, reiserfs things
 - fanotify
 - I appear to have become SuperH maintainer
 - ocfs2 updates
 - direct-io tweaks
 - a bit of the MM queue
 - printk updates
 - MAINTAINERS maintenance
 - some backlight things
 - lib/ updates
 - checkpatch updates
 - the rtc queue
 - nilfs2 updates
 - Small Documentation/ updates

* emailed patches from Andrew Morton &lt;akpm@linux-foundation.org&gt;: (237 commits)
  Documentation/SubmittingPatches: remove references to patch-scripts
  Documentation/SubmittingPatches: update some dead URLs
  Documentation/filesystems/ntfs.txt: remove changelog reference
  Documentation/kmemleak.txt: updates
  fs/reiserfs/super.c: add __init to init_inodecache
  fs/reiserfs: move prototype declaration to header file
  fs/hfsplus/attributes.c: add __init to hfsplus_create_attr_tree_cache()
  fs/hfsplus/extents.c: fix concurrent acess of alloc_blocks
  fs/hfsplus/extents.c: remove unused variable in hfsplus_get_block
  nilfs2: update project's web site in nilfs2.txt
  nilfs2: update MAINTAINERS file entries fix
  nilfs2: verify metadata sizes read from disk
  nilfs2: add FITRIM ioctl support for nilfs2
  nilfs2: add nilfs_sufile_trim_fs to trim clean segs
  nilfs2: implementation of NILFS_IOCTL_SET_SUINFO ioctl
  nilfs2: add nilfs_sufile_set_suinfo to update segment usage
  nilfs2: add struct nilfs_suinfo_update and flags
  nilfs2: update MAINTAINERS file entries
  fs/coda/inode.c: add __init to init_inodecache()
  BEFS: logging cleanup
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Merge first patch-bomb from Andrew Morton:
 - Various misc bits
 - kmemleak fixes
 - small befs, codafs, cifs, efs, freexxfs, hfsplus, minixfs, reiserfs things
 - fanotify
 - I appear to have become SuperH maintainer
 - ocfs2 updates
 - direct-io tweaks
 - a bit of the MM queue
 - printk updates
 - MAINTAINERS maintenance
 - some backlight things
 - lib/ updates
 - checkpatch updates
 - the rtc queue
 - nilfs2 updates
 - Small Documentation/ updates

* emailed patches from Andrew Morton &lt;akpm@linux-foundation.org&gt;: (237 commits)
  Documentation/SubmittingPatches: remove references to patch-scripts
  Documentation/SubmittingPatches: update some dead URLs
  Documentation/filesystems/ntfs.txt: remove changelog reference
  Documentation/kmemleak.txt: updates
  fs/reiserfs/super.c: add __init to init_inodecache
  fs/reiserfs: move prototype declaration to header file
  fs/hfsplus/attributes.c: add __init to hfsplus_create_attr_tree_cache()
  fs/hfsplus/extents.c: fix concurrent acess of alloc_blocks
  fs/hfsplus/extents.c: remove unused variable in hfsplus_get_block
  nilfs2: update project's web site in nilfs2.txt
  nilfs2: update MAINTAINERS file entries fix
  nilfs2: verify metadata sizes read from disk
  nilfs2: add FITRIM ioctl support for nilfs2
  nilfs2: add nilfs_sufile_trim_fs to trim clean segs
  nilfs2: implementation of NILFS_IOCTL_SET_SUINFO ioctl
  nilfs2: add nilfs_sufile_set_suinfo to update segment usage
  nilfs2: add struct nilfs_suinfo_update and flags
  nilfs2: update MAINTAINERS file entries
  fs/coda/inode.c: add __init to init_inodecache()
  BEFS: logging cleanup
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>mm + fs: store shadow entries in page cache</title>
<updated>2014-04-03T23:21:01+00:00</updated>
<author>
<name>Johannes Weiner</name>
<email>hannes@cmpxchg.org</email>
</author>
<published>2014-04-03T21:47:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=91b0abe36a7b2b3b02d7500925a5f8455334f0e5'/>
<id>91b0abe36a7b2b3b02d7500925a5f8455334f0e5</id>
<content type='text'>
Reclaim will be leaving shadow entries in the page cache radix tree upon
evicting the real page.  As those pages are found from the LRU, an
iput() can lead to the inode being freed concurrently.  At this point,
reclaim must no longer install shadow pages because the inode freeing
code needs to ensure the page tree is really empty.

Add an address_space flag, AS_EXITING, that the inode freeing code sets
under the tree lock before doing the final truncate.  Reclaim will check
for this flag before installing shadow pages.

Signed-off-by: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Reviewed-by: Rik van Riel &lt;riel@redhat.com&gt;
Reviewed-by: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Andrea Arcangeli &lt;aarcange@redhat.com&gt;
Cc: Bob Liu &lt;bob.liu@oracle.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Dave Chinner &lt;david@fromorbit.com&gt;
Cc: Greg Thelen &lt;gthelen@google.com&gt;
Cc: Hugh Dickins &lt;hughd@google.com&gt;
Cc: Jan Kara &lt;jack@suse.cz&gt;
Cc: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;
Cc: Luigi Semenzato &lt;semenzato@google.com&gt;
Cc: Mel Gorman &lt;mgorman@suse.de&gt;
Cc: Metin Doslu &lt;metin@citusdata.com&gt;
Cc: Michel Lespinasse &lt;walken@google.com&gt;
Cc: Ozgun Erdogan &lt;ozgun@citusdata.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Roman Gushchin &lt;klamm@yandex-team.ru&gt;
Cc: Ryan Mallon &lt;rmallon@gmail.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reclaim will be leaving shadow entries in the page cache radix tree upon
evicting the real page.  As those pages are found from the LRU, an
iput() can lead to the inode being freed concurrently.  At this point,
reclaim must no longer install shadow pages because the inode freeing
code needs to ensure the page tree is really empty.

Add an address_space flag, AS_EXITING, that the inode freeing code sets
under the tree lock before doing the final truncate.  Reclaim will check
for this flag before installing shadow pages.

Signed-off-by: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Reviewed-by: Rik van Riel &lt;riel@redhat.com&gt;
Reviewed-by: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Andrea Arcangeli &lt;aarcange@redhat.com&gt;
Cc: Bob Liu &lt;bob.liu@oracle.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Dave Chinner &lt;david@fromorbit.com&gt;
Cc: Greg Thelen &lt;gthelen@google.com&gt;
Cc: Hugh Dickins &lt;hughd@google.com&gt;
Cc: Jan Kara &lt;jack@suse.cz&gt;
Cc: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;
Cc: Luigi Semenzato &lt;semenzato@google.com&gt;
Cc: Mel Gorman &lt;mgorman@suse.de&gt;
Cc: Metin Doslu &lt;metin@citusdata.com&gt;
Cc: Michel Lespinasse &lt;walken@google.com&gt;
Cc: Ozgun Erdogan &lt;ozgun@citusdata.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Roman Gushchin &lt;klamm@yandex-team.ru&gt;
Cc: Ryan Mallon &lt;rmallon@gmail.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'for-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup</title>
<updated>2014-04-03T20:05:42+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2014-04-03T20:05:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=32d01dc7be4e725ab85ce1d74e8f4adc02ad68dd'/>
<id>32d01dc7be4e725ab85ce1d74e8f4adc02ad68dd</id>
<content type='text'>
Pull cgroup updates from Tejun Heo:
 "A lot updates for cgroup:

   - The biggest one is cgroup's conversion to kernfs.  cgroup took
     after the long abandoned vfs-entangled sysfs implementation and
     made it even more convoluted over time.  cgroup's internal objects
     were fused with vfs objects which also brought in vfs locking and
     object lifetime rules.  Naturally, there are places where vfs rules
     don't fit and nasty hacks, such as credential switching or lock
     dance interleaving inode mutex and cgroup_mutex with object serial
     number comparison thrown in to decide whether the operation is
     actually necessary, needed to be employed.

     After conversion to kernfs, internal object lifetime and locking
     rules are mostly isolated from vfs interactions allowing shedding
     of several nasty hacks and overall simplification.  This will also
     allow implmentation of operations which may affect multiple cgroups
     which weren't possible before as it would have required nesting
     i_mutexes.

   - Various simplifications including dropping of module support,
     easier cgroup name/path handling, simplified cgroup file type
     handling and task_cg_lists optimization.

   - Prepatory changes for the planned unified hierarchy, which is still
     a patchset away from being actually operational.  The dummy
     hierarchy is updated to serve as the default unified hierarchy.
     Controllers which aren't claimed by other hierarchies are
     associated with it, which BTW was what the dummy hierarchy was for
     anyway.

   - Various fixes from Li and others.  This pull request includes some
     patches to add missing slab.h to various subsystems.  This was
     triggered xattr.h include removal from cgroup.h.  cgroup.h
     indirectly got included a lot of files which brought in xattr.h
     which brought in slab.h.

  There are several merge commits - one to pull in kernfs updates
  necessary for converting cgroup (already in upstream through
  driver-core), others for interfering changes in the fixes branch"

* 'for-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (74 commits)
  cgroup: remove useless argument from cgroup_exit()
  cgroup: fix spurious lockdep warning in cgroup_exit()
  cgroup: Use RCU_INIT_POINTER(x, NULL) in cgroup.c
  cgroup: break kernfs active_ref protection in cgroup directory operations
  cgroup: fix cgroup_taskset walking order
  cgroup: implement CFTYPE_ONLY_ON_DFL
  cgroup: make cgrp_dfl_root mountable
  cgroup: drop const from @buffer of cftype-&gt;write_string()
  cgroup: rename cgroup_dummy_root and related names
  cgroup: move -&gt;subsys_mask from cgroupfs_root to cgroup
  cgroup: treat cgroup_dummy_root as an equivalent hierarchy during rebinding
  cgroup: remove NULL checks from [pr_cont_]cgroup_{name|path}()
  cgroup: use cgroup_setup_root() to initialize cgroup_dummy_root
  cgroup: reorganize cgroup bootstrapping
  cgroup: relocate setting of CGRP_DEAD
  cpuset: use rcu_read_lock() to protect task_cs()
  cgroup_freezer: document freezer_fork() subtleties
  cgroup: update cgroup_transfer_tasks() to either succeed or fail
  cgroup: drop task_lock() protection around task-&gt;cgroups
  cgroup: update how a newly forked task gets associated with css_set
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull cgroup updates from Tejun Heo:
 "A lot updates for cgroup:

   - The biggest one is cgroup's conversion to kernfs.  cgroup took
     after the long abandoned vfs-entangled sysfs implementation and
     made it even more convoluted over time.  cgroup's internal objects
     were fused with vfs objects which also brought in vfs locking and
     object lifetime rules.  Naturally, there are places where vfs rules
     don't fit and nasty hacks, such as credential switching or lock
     dance interleaving inode mutex and cgroup_mutex with object serial
     number comparison thrown in to decide whether the operation is
     actually necessary, needed to be employed.

     After conversion to kernfs, internal object lifetime and locking
     rules are mostly isolated from vfs interactions allowing shedding
     of several nasty hacks and overall simplification.  This will also
     allow implmentation of operations which may affect multiple cgroups
     which weren't possible before as it would have required nesting
     i_mutexes.

   - Various simplifications including dropping of module support,
     easier cgroup name/path handling, simplified cgroup file type
     handling and task_cg_lists optimization.

   - Prepatory changes for the planned unified hierarchy, which is still
     a patchset away from being actually operational.  The dummy
     hierarchy is updated to serve as the default unified hierarchy.
     Controllers which aren't claimed by other hierarchies are
     associated with it, which BTW was what the dummy hierarchy was for
     anyway.

   - Various fixes from Li and others.  This pull request includes some
     patches to add missing slab.h to various subsystems.  This was
     triggered xattr.h include removal from cgroup.h.  cgroup.h
     indirectly got included a lot of files which brought in xattr.h
     which brought in slab.h.

  There are several merge commits - one to pull in kernfs updates
  necessary for converting cgroup (already in upstream through
  driver-core), others for interfering changes in the fixes branch"

* 'for-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (74 commits)
  cgroup: remove useless argument from cgroup_exit()
  cgroup: fix spurious lockdep warning in cgroup_exit()
  cgroup: Use RCU_INIT_POINTER(x, NULL) in cgroup.c
  cgroup: break kernfs active_ref protection in cgroup directory operations
  cgroup: fix cgroup_taskset walking order
  cgroup: implement CFTYPE_ONLY_ON_DFL
  cgroup: make cgrp_dfl_root mountable
  cgroup: drop const from @buffer of cftype-&gt;write_string()
  cgroup: rename cgroup_dummy_root and related names
  cgroup: move -&gt;subsys_mask from cgroupfs_root to cgroup
  cgroup: treat cgroup_dummy_root as an equivalent hierarchy during rebinding
  cgroup: remove NULL checks from [pr_cont_]cgroup_{name|path}()
  cgroup: use cgroup_setup_root() to initialize cgroup_dummy_root
  cgroup: reorganize cgroup bootstrapping
  cgroup: relocate setting of CGRP_DEAD
  cpuset: use rcu_read_lock() to protect task_cs()
  cgroup_freezer: document freezer_fork() subtleties
  cgroup: update cgroup_transfer_tasks() to either succeed or fail
  cgroup: drop task_lock() protection around task-&gt;cgroups
  cgroup: update how a newly forked task gets associated with css_set
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>kernfs: cache atomic_write_len in kernfs_open_file</title>
<updated>2014-03-09T06:08:29+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2014-03-04T20:38:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b7ce40cff0b9f6597f8318fd761accd92727f61f'/>
<id>b7ce40cff0b9f6597f8318fd761accd92727f61f</id>
<content type='text'>
While implementing atomic_write_len, 4d3773c4bb41 ("kernfs: implement
kernfs_ops-&gt;atomic_write_len") moved data copy from userland inside
kernfs_get_active() and kernfs_open_file-&gt;mutex so that
kernfs_ops-&gt;atomic_write_len can be accessed before copying buffer
from userland; unfortunately, this could lead to locking order
inversion involving mmap_sem if copy_from_user() takes a page fault.

  ======================================================
  [ INFO: possible circular locking dependency detected ]
  3.14.0-rc4-next-20140228-sasha-00011-g4077c67-dirty #26 Tainted: G        W
  -------------------------------------------------------
  trinity-c236/10658 is trying to acquire lock:
   (&amp;of-&gt;mutex#2){+.+.+.}, at: [&lt;fs/kernfs/file.c:487&gt;] kernfs_fop_mmap+0x54/0x120

  but task is already holding lock:
   (&amp;mm-&gt;mmap_sem){++++++}, at: [&lt;mm/util.c:397&gt;] vm_mmap_pgoff+0x6e/0xe0

  which lock already depends on the new lock.

  the existing dependency chain (in reverse order) is:

 -&gt; #1 (&amp;mm-&gt;mmap_sem){++++++}:
	 [&lt;kernel/locking/lockdep.c:1945 kernel/locking/lockdep.c:2131&gt;] validate_chain+0x6c5/0x7b0
	 [&lt;kernel/locking/lockdep.c:3182&gt;] __lock_acquire+0x4cd/0x5a0
	 [&lt;arch/x86/include/asm/current.h:14 kernel/locking/lockdep.c:3602&gt;] lock_acquire+0x182/0x1d0
	 [&lt;mm/memory.c:4188&gt;] might_fault+0x7e/0xb0
	 [&lt;arch/x86/include/asm/uaccess.h:713 fs/kernfs/file.c:291&gt;] kernfs_fop_write+0xd8/0x190
	 [&lt;fs/read_write.c:473&gt;] vfs_write+0xe3/0x1d0
	 [&lt;fs/read_write.c:523 fs/read_write.c:515&gt;] SyS_write+0x5d/0xa0
	 [&lt;arch/x86/kernel/entry_64.S:749&gt;] tracesys+0xdd/0xe2

 -&gt; #0 (&amp;of-&gt;mutex#2){+.+.+.}:
	 [&lt;kernel/locking/lockdep.c:1840&gt;] check_prev_add+0x13f/0x560
	 [&lt;kernel/locking/lockdep.c:1945 kernel/locking/lockdep.c:2131&gt;] validate_chain+0x6c5/0x7b0
	 [&lt;kernel/locking/lockdep.c:3182&gt;] __lock_acquire+0x4cd/0x5a0
	 [&lt;arch/x86/include/asm/current.h:14 kernel/locking/lockdep.c:3602&gt;] lock_acquire+0x182/0x1d0
	 [&lt;kernel/locking/mutex.c:470 kernel/locking/mutex.c:571&gt;] mutex_lock_nested+0x6a/0x510
	 [&lt;fs/kernfs/file.c:487&gt;] kernfs_fop_mmap+0x54/0x120
	 [&lt;mm/mmap.c:1573&gt;] mmap_region+0x310/0x5c0
	 [&lt;mm/mmap.c:1365&gt;] do_mmap_pgoff+0x385/0x430
	 [&lt;mm/util.c:399&gt;] vm_mmap_pgoff+0x8f/0xe0
	 [&lt;mm/mmap.c:1416 mm/mmap.c:1374&gt;] SyS_mmap_pgoff+0x1b0/0x210
	 [&lt;arch/x86/kernel/sys_x86_64.c:72&gt;] SyS_mmap+0x1d/0x20
	 [&lt;arch/x86/kernel/entry_64.S:749&gt;] tracesys+0xdd/0xe2

  other info that might help us debug this:

   Possible unsafe locking scenario:

	 CPU0                    CPU1
	 ----                    ----
    lock(&amp;mm-&gt;mmap_sem);
				 lock(&amp;of-&gt;mutex#2);
				 lock(&amp;mm-&gt;mmap_sem);
    lock(&amp;of-&gt;mutex#2);

   *** DEADLOCK ***

  1 lock held by trinity-c236/10658:
   #0:  (&amp;mm-&gt;mmap_sem){++++++}, at: [&lt;mm/util.c:397&gt;] vm_mmap_pgoff+0x6e/0xe0

  stack backtrace:
  CPU: 2 PID: 10658 Comm: trinity-c236 Tainted: G        W 3.14.0-rc4-next-20140228-sasha-00011-g4077c67-dirty #26
   0000000000000000 ffff88011911fa48 ffffffff8438e945 0000000000000000
   0000000000000000 ffff88011911fa98 ffffffff811a0109 ffff88011911fab8
   ffff88011911fab8 ffff88011911fa98 ffff880119128cc0 ffff880119128cf8
  Call Trace:
   [&lt;lib/dump_stack.c:52&gt;] dump_stack+0x52/0x7f
   [&lt;kernel/locking/lockdep.c:1213&gt;] print_circular_bug+0x129/0x160
   [&lt;kernel/locking/lockdep.c:1840&gt;] check_prev_add+0x13f/0x560
   [&lt;include/linux/spinlock.h:343 mm/slub.c:1933&gt;] ? deactivate_slab+0x511/0x550
   [&lt;kernel/locking/lockdep.c:1945 kernel/locking/lockdep.c:2131&gt;] validate_chain+0x6c5/0x7b0
   [&lt;kernel/locking/lockdep.c:3182&gt;] __lock_acquire+0x4cd/0x5a0
   [&lt;mm/mmap.c:1552&gt;] ? mmap_region+0x24a/0x5c0
   [&lt;arch/x86/include/asm/current.h:14 kernel/locking/lockdep.c:3602&gt;] lock_acquire+0x182/0x1d0
   [&lt;fs/kernfs/file.c:487&gt;] ? kernfs_fop_mmap+0x54/0x120
   [&lt;kernel/locking/mutex.c:470 kernel/locking/mutex.c:571&gt;] mutex_lock_nested+0x6a/0x510
   [&lt;fs/kernfs/file.c:487&gt;] ? kernfs_fop_mmap+0x54/0x120
   [&lt;kernel/sched/core.c:2477&gt;] ? get_parent_ip+0x11/0x50
   [&lt;fs/kernfs/file.c:487&gt;] ? kernfs_fop_mmap+0x54/0x120
   [&lt;fs/kernfs/file.c:487&gt;] kernfs_fop_mmap+0x54/0x120
   [&lt;mm/mmap.c:1573&gt;] mmap_region+0x310/0x5c0
   [&lt;mm/mmap.c:1365&gt;] do_mmap_pgoff+0x385/0x430
   [&lt;mm/util.c:397&gt;] ? vm_mmap_pgoff+0x6e/0xe0
   [&lt;mm/util.c:399&gt;] vm_mmap_pgoff+0x8f/0xe0
   [&lt;kernel/rcu/update.c:97&gt;] ? __rcu_read_unlock+0x44/0xb0
   [&lt;fs/file.c:641&gt;] ? dup_fd+0x3c0/0x3c0
   [&lt;mm/mmap.c:1416 mm/mmap.c:1374&gt;] SyS_mmap_pgoff+0x1b0/0x210
   [&lt;arch/x86/kernel/sys_x86_64.c:72&gt;] SyS_mmap+0x1d/0x20
   [&lt;arch/x86/kernel/entry_64.S:749&gt;] tracesys+0xdd/0xe2

Fix it by caching atomic_write_len in kernfs_open_file during open so
that it can be determined without accessing kernfs_ops in
kernfs_fop_write().  This restores the structure of kernfs_fop_write()
before 4d3773c4bb41 with updated @len determination logic.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
References: http://lkml.kernel.org/g/53113485.2090407@oracle.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While implementing atomic_write_len, 4d3773c4bb41 ("kernfs: implement
kernfs_ops-&gt;atomic_write_len") moved data copy from userland inside
kernfs_get_active() and kernfs_open_file-&gt;mutex so that
kernfs_ops-&gt;atomic_write_len can be accessed before copying buffer
from userland; unfortunately, this could lead to locking order
inversion involving mmap_sem if copy_from_user() takes a page fault.

  ======================================================
  [ INFO: possible circular locking dependency detected ]
  3.14.0-rc4-next-20140228-sasha-00011-g4077c67-dirty #26 Tainted: G        W
  -------------------------------------------------------
  trinity-c236/10658 is trying to acquire lock:
   (&amp;of-&gt;mutex#2){+.+.+.}, at: [&lt;fs/kernfs/file.c:487&gt;] kernfs_fop_mmap+0x54/0x120

  but task is already holding lock:
   (&amp;mm-&gt;mmap_sem){++++++}, at: [&lt;mm/util.c:397&gt;] vm_mmap_pgoff+0x6e/0xe0

  which lock already depends on the new lock.

  the existing dependency chain (in reverse order) is:

 -&gt; #1 (&amp;mm-&gt;mmap_sem){++++++}:
	 [&lt;kernel/locking/lockdep.c:1945 kernel/locking/lockdep.c:2131&gt;] validate_chain+0x6c5/0x7b0
	 [&lt;kernel/locking/lockdep.c:3182&gt;] __lock_acquire+0x4cd/0x5a0
	 [&lt;arch/x86/include/asm/current.h:14 kernel/locking/lockdep.c:3602&gt;] lock_acquire+0x182/0x1d0
	 [&lt;mm/memory.c:4188&gt;] might_fault+0x7e/0xb0
	 [&lt;arch/x86/include/asm/uaccess.h:713 fs/kernfs/file.c:291&gt;] kernfs_fop_write+0xd8/0x190
	 [&lt;fs/read_write.c:473&gt;] vfs_write+0xe3/0x1d0
	 [&lt;fs/read_write.c:523 fs/read_write.c:515&gt;] SyS_write+0x5d/0xa0
	 [&lt;arch/x86/kernel/entry_64.S:749&gt;] tracesys+0xdd/0xe2

 -&gt; #0 (&amp;of-&gt;mutex#2){+.+.+.}:
	 [&lt;kernel/locking/lockdep.c:1840&gt;] check_prev_add+0x13f/0x560
	 [&lt;kernel/locking/lockdep.c:1945 kernel/locking/lockdep.c:2131&gt;] validate_chain+0x6c5/0x7b0
	 [&lt;kernel/locking/lockdep.c:3182&gt;] __lock_acquire+0x4cd/0x5a0
	 [&lt;arch/x86/include/asm/current.h:14 kernel/locking/lockdep.c:3602&gt;] lock_acquire+0x182/0x1d0
	 [&lt;kernel/locking/mutex.c:470 kernel/locking/mutex.c:571&gt;] mutex_lock_nested+0x6a/0x510
	 [&lt;fs/kernfs/file.c:487&gt;] kernfs_fop_mmap+0x54/0x120
	 [&lt;mm/mmap.c:1573&gt;] mmap_region+0x310/0x5c0
	 [&lt;mm/mmap.c:1365&gt;] do_mmap_pgoff+0x385/0x430
	 [&lt;mm/util.c:399&gt;] vm_mmap_pgoff+0x8f/0xe0
	 [&lt;mm/mmap.c:1416 mm/mmap.c:1374&gt;] SyS_mmap_pgoff+0x1b0/0x210
	 [&lt;arch/x86/kernel/sys_x86_64.c:72&gt;] SyS_mmap+0x1d/0x20
	 [&lt;arch/x86/kernel/entry_64.S:749&gt;] tracesys+0xdd/0xe2

  other info that might help us debug this:

   Possible unsafe locking scenario:

	 CPU0                    CPU1
	 ----                    ----
    lock(&amp;mm-&gt;mmap_sem);
				 lock(&amp;of-&gt;mutex#2);
				 lock(&amp;mm-&gt;mmap_sem);
    lock(&amp;of-&gt;mutex#2);

   *** DEADLOCK ***

  1 lock held by trinity-c236/10658:
   #0:  (&amp;mm-&gt;mmap_sem){++++++}, at: [&lt;mm/util.c:397&gt;] vm_mmap_pgoff+0x6e/0xe0

  stack backtrace:
  CPU: 2 PID: 10658 Comm: trinity-c236 Tainted: G        W 3.14.0-rc4-next-20140228-sasha-00011-g4077c67-dirty #26
   0000000000000000 ffff88011911fa48 ffffffff8438e945 0000000000000000
   0000000000000000 ffff88011911fa98 ffffffff811a0109 ffff88011911fab8
   ffff88011911fab8 ffff88011911fa98 ffff880119128cc0 ffff880119128cf8
  Call Trace:
   [&lt;lib/dump_stack.c:52&gt;] dump_stack+0x52/0x7f
   [&lt;kernel/locking/lockdep.c:1213&gt;] print_circular_bug+0x129/0x160
   [&lt;kernel/locking/lockdep.c:1840&gt;] check_prev_add+0x13f/0x560
   [&lt;include/linux/spinlock.h:343 mm/slub.c:1933&gt;] ? deactivate_slab+0x511/0x550
   [&lt;kernel/locking/lockdep.c:1945 kernel/locking/lockdep.c:2131&gt;] validate_chain+0x6c5/0x7b0
   [&lt;kernel/locking/lockdep.c:3182&gt;] __lock_acquire+0x4cd/0x5a0
   [&lt;mm/mmap.c:1552&gt;] ? mmap_region+0x24a/0x5c0
   [&lt;arch/x86/include/asm/current.h:14 kernel/locking/lockdep.c:3602&gt;] lock_acquire+0x182/0x1d0
   [&lt;fs/kernfs/file.c:487&gt;] ? kernfs_fop_mmap+0x54/0x120
   [&lt;kernel/locking/mutex.c:470 kernel/locking/mutex.c:571&gt;] mutex_lock_nested+0x6a/0x510
   [&lt;fs/kernfs/file.c:487&gt;] ? kernfs_fop_mmap+0x54/0x120
   [&lt;kernel/sched/core.c:2477&gt;] ? get_parent_ip+0x11/0x50
   [&lt;fs/kernfs/file.c:487&gt;] ? kernfs_fop_mmap+0x54/0x120
   [&lt;fs/kernfs/file.c:487&gt;] kernfs_fop_mmap+0x54/0x120
   [&lt;mm/mmap.c:1573&gt;] mmap_region+0x310/0x5c0
   [&lt;mm/mmap.c:1365&gt;] do_mmap_pgoff+0x385/0x430
   [&lt;mm/util.c:397&gt;] ? vm_mmap_pgoff+0x6e/0xe0
   [&lt;mm/util.c:399&gt;] vm_mmap_pgoff+0x8f/0xe0
   [&lt;kernel/rcu/update.c:97&gt;] ? __rcu_read_unlock+0x44/0xb0
   [&lt;fs/file.c:641&gt;] ? dup_fd+0x3c0/0x3c0
   [&lt;mm/mmap.c:1416 mm/mmap.c:1374&gt;] SyS_mmap_pgoff+0x1b0/0x210
   [&lt;arch/x86/kernel/sys_x86_64.c:72&gt;] SyS_mmap+0x1d/0x20
   [&lt;arch/x86/kernel/entry_64.S:749&gt;] tracesys+0xdd/0xe2

Fix it by caching atomic_write_len in kernfs_open_file during open so
that it can be determined without accessing kernfs_ops in
kernfs_fop_write().  This restores the structure of kernfs_fop_write()
before 4d3773c4bb41 with updated @len determination logic.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
References: http://lkml.kernel.org/g/53113485.2090407@oracle.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kernfs: fix off by one error.</title>
<updated>2014-03-09T06:08:29+00:00</updated>
<author>
<name>Richard Cochran</name>
<email>richardcochran@gmail.com</email>
</author>
<published>2014-03-05T16:10:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=88391d49abb7d8dee91d405f96bd9e003cb6798d'/>
<id>88391d49abb7d8dee91d405f96bd9e003cb6798d</id>
<content type='text'>
The hash values 0 and 1 are reserved for magic directory entries, but
the code only prevents names hashing to 0. This patch fixes the test
to also prevent hash value 1.

Signed-off-by: Richard Cochran &lt;richardcochran@gmail.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Reviewed-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The hash values 0 and 1 are reserved for magic directory entries, but
the code only prevents names hashing to 0. This patch fixes the test
to also prevent hash value 1.

Signed-off-by: Richard Cochran &lt;richardcochran@gmail.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Reviewed-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge 3.14-rc5 into driver-core-next</title>
<updated>2014-03-03T04:09:08+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2014-03-03T04:09:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=13df7977431e3b906a23bb75f29e0f40a8d73f87'/>
<id>13df7977431e3b906a23bb75f29e0f40a8d73f87</id>
<content type='text'>
We want the fixes in here.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We want the fixes in here.
</pre>
</div>
</content>
</entry>
</feed>
