<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/security/device_cgroup.c, branch v3.9.7</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.9.7</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.9.7'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2013-02-22T01:22:15Z</updated>
<entry>
<title>device_cgroup: don't grab mutex in rcu callback</title>
<updated>2013-02-22T01:22:15Z</updated>
<author>
<name>Jerry Snitselaar</name>
<email>jerry.snitselaar@oracle.com</email>
</author>
<published>2013-02-22T00:41:31Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=53eb8c82d581fdd4b389a3e417261f3ae924e603'/>
<id>urn:sha1:53eb8c82d581fdd4b389a3e417261f3ae924e603</id>
<content type='text'>
Commit 103a197c0c4e ("security/device_cgroup: lock assert fails in
dev_exception_clean()") grabs devcgroup_mutex to fix assert failure, but
a mutex can't be grabbed in rcu callback.  Since there shouldn't be any
other references when css_free is called, mutex isn't needed for list
cleanup in devcgroup_css_free().

Signed-off-by: Jerry Snitselaar &lt;jerry.snitselaar@oracle.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Aristeu Rozanski &lt;aris@redhat.com&gt;
Cc: James Morris &lt;james.l.morris@oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>security/device_cgroup: lock assert fails in dev_exception_clean()</title>
<updated>2013-01-21T13:27:55Z</updated>
<author>
<name>Jerry Snitselaar</name>
<email>jerry.snitselaar@oracle.com</email>
</author>
<published>2013-01-17T08:04:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=103a197c0c4ec936f5a243b5b092e4e49213f569'/>
<id>urn:sha1:103a197c0c4ec936f5a243b5b092e4e49213f569</id>
<content type='text'>
devcgroup_css_free() calls dev_exception_clean() without the devcgroup_mutex being locked.

Shutting down a kvm virt was giving me the following trace:

[36280.732764] ------------[ cut here ]------------
[36280.732778] WARNING: at /home/snits/dev/linux/security/device_cgroup.c:172 dev_exception_clean+0xa9/0xc0()
[36280.732782] Hardware name: Studio XPS 8100
[36280.732785] Modules linked in: xt_REDIRECT fuse ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_nat xt_CHECKSUM iptable_mangle bridge stp llc nf_conntrack_ipv4 ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 nf_defrag_ipv4 ip6table_filter it87 hwmon_vid xt_state nf_conntrack ip6_tables snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_seq coretemp snd_seq_device crc32c_intel snd_pcm snd_page_alloc snd_timer snd broadcom tg3 serio_raw i7core_edac edac_core ptp pps_core lpc_ich pcspkr mfd_core soundcore microcode i2c_i801 nfsd auth_rpcgss nfs_acl lockd vhost_net sunrpc tun macvtap macvlan kvm_intel kvm uinput binfmt_misc autofs4 usb_storage firewire_ohci firewire_core crc_itu_t radeon drm_kms_helper ttm
[36280.732921] Pid: 933, comm: libvirtd Tainted: G        W    3.8.0-rc3-00307-g4c217de #1
[36280.732922] Call Trace:
[36280.732927]  [&lt;ffffffff81044303&gt;] warn_slowpath_common+0x93/0xc0
[36280.732930]  [&lt;ffffffff8104434a&gt;] warn_slowpath_null+0x1a/0x20
[36280.732932]  [&lt;ffffffff812deaf9&gt;] dev_exception_clean+0xa9/0xc0
[36280.732934]  [&lt;ffffffff812deb2a&gt;] devcgroup_css_free+0x1a/0x30
[36280.732938]  [&lt;ffffffff810ccd76&gt;] cgroup_diput+0x76/0x210
[36280.732941]  [&lt;ffffffff8119eac0&gt;] d_delete+0x120/0x180
[36280.732943]  [&lt;ffffffff81195cff&gt;] vfs_rmdir+0xef/0x130
[36280.732945]  [&lt;ffffffff81195e47&gt;] do_rmdir+0x107/0x1c0
[36280.732949]  [&lt;ffffffff8132d17e&gt;] ? trace_hardirqs_on_thunk+0x3a/0x3f
[36280.732951]  [&lt;ffffffff81198646&gt;] sys_rmdir+0x16/0x20
[36280.732954]  [&lt;ffffffff8173bd82&gt;] system_call_fastpath+0x16/0x1b
[36280.732956] ---[ end trace ca39dced899a7d9f ]---

Signed-off-by: Jerry Snitselaar &lt;jerry.snitselaar@oracle.com&gt;
Cc: stable@kernel.org
Signed-off-by: James Morris &lt;james.l.morris@oracle.com&gt;
</content>
</entry>
<entry>
<title>cgroup: rename -&gt;create/post_create/pre_destroy/destroy() to -&gt;css_alloc/online/offline/free()</title>
<updated>2012-11-19T16:13:38Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-11-19T16:13:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=92fb97487a7e41b222c1417cabd1d1ab7cc3a48c'/>
<id>urn:sha1:92fb97487a7e41b222c1417cabd1d1ab7cc3a48c</id>
<content type='text'>
Rename cgroup_subsys css lifetime related callbacks to better describe
what their roles are.  Also, update documentation.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Li Zefan &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>device_cgroup: add lockdep asserts</title>
<updated>2012-11-06T20:28:04Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-11-06T17:16:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4b1c7840b7d01b14a1a00fa0e61b761d4391ba67'/>
<id>urn:sha1:4b1c7840b7d01b14a1a00fa0e61b761d4391ba67</id>
<content type='text'>
device_cgroup uses RCU safe -&gt;exceptions list which is write-protected
by devcgroup_mutex and has had some issues using locking correctly.
Add lockdep asserts to utility functions so that future errors can be
easily detected.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Serge E. Hallyn &lt;serge.hallyn@ubuntu.com&gt;
Cc: Aristeu Rozanski &lt;aris@redhat.com&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>device_cgroup: fix RCU usage</title>
<updated>2012-11-06T20:25:51Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-11-06T17:17:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=201e72acb2d3821e2de9ce6091e98859c316b29a'/>
<id>urn:sha1:201e72acb2d3821e2de9ce6091e98859c316b29a</id>
<content type='text'>
dev_cgroup-&gt;exceptions is protected with devcgroup_mutex for writes
and RCU for reads; however, RCU usage isn't correct.

* dev_exception_clean() doesn't use RCU variant of list_del() and
  kfree().  The function can race with may_access() and may_access()
  may end up dereferencing already freed memory.  Use list_del_rcu()
  and kfree_rcu() instead.

* may_access() may be called only with RCU read locked but doesn't use
  RCU safe traversal over -&gt;exceptions.  Use list_for_each_entry_rcu().

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Serge E. Hallyn &lt;serge.hallyn@ubuntu.com&gt;
Cc: stable@vger.kernel.org
Cc: Aristeu Rozanski &lt;aris@redhat.com&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>device_cgroup: fix unchecked cgroup parent usage</title>
<updated>2012-11-06T15:25:20Z</updated>
<author>
<name>Aristeu Rozanski</name>
<email>aris@redhat.com</email>
</author>
<published>2012-11-06T15:25:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=64e104771351d365e51e588a0e9a656ae6ed2f50'/>
<id>urn:sha1:64e104771351d365e51e588a0e9a656ae6ed2f50</id>
<content type='text'>
In 4cef7299b478687 ("device_cgroup: add proper checking when changing
default behavior") the cgroup parent usage is unchecked.  root will not
have a parent and trying to use device.{allow,deny} will cause problems.
For some reason my stressing scripts didn't test the root directory so I
didn't catch it on my regular tests.

Signed-off-by: Aristeu Rozanski &lt;aris@redhat.com&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
Cc: James Morris &lt;jmorris@namei.org&gt;
Cc: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Acked-by: Serge E. Hallyn &lt;serge.hallyn@ubuntu.com&gt;
Cc: Jiri Slaby &lt;jslaby@suse.cz&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>device_cgroup: add proper checking when changing default behavior</title>
<updated>2012-10-25T21:37:52Z</updated>
<author>
<name>Aristeu Rozanski</name>
<email>aris@redhat.com</email>
</author>
<published>2012-10-25T20:37:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4cef7299b4786879a3e113e84084a72b24590c5b'/>
<id>urn:sha1:4cef7299b4786879a3e113e84084a72b24590c5b</id>
<content type='text'>
Before changing a group's default behavior to ALLOW, we must check if
its parent's behavior is also ALLOW.

Signed-off-by: Aristeu Rozanski &lt;aris@redhat.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
Cc: James Morris &lt;jmorris@namei.org&gt;
Cc: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Acked-by: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Cc: Jiri Slaby &lt;jslaby@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>
</entry>
<entry>
<title>device_cgroup: stop using simple_strtoul()</title>
<updated>2012-10-25T21:37:52Z</updated>
<author>
<name>Aristeu Rozanski</name>
<email>aris@redhat.com</email>
</author>
<published>2012-10-25T20:37:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=26fd8405dd470cb8b54cb96859b7dd437e5e1391'/>
<id>urn:sha1:26fd8405dd470cb8b54cb96859b7dd437e5e1391</id>
<content type='text'>
Convert the code to use kstrtou32() instead of simple_strtoul() which is
deprecated.  The real size of the variables are u32, so use kstrtou32
instead of kstrtoul

Signed-off-by: Aristeu Rozanski &lt;aris@redhat.com&gt;
Cc: Dave Jones &lt;davej@redhat.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
Cc: James Morris &lt;jmorris@namei.org&gt;
Cc: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Acked-by: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Cc: Jiri Slaby &lt;jslaby@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>
</entry>
<entry>
<title>device_cgroup: rename deny_all to behavior</title>
<updated>2012-10-25T21:37:52Z</updated>
<author>
<name>Aristeu Rozanski</name>
<email>aris@redhat.com</email>
</author>
<published>2012-10-25T20:37:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5b7aa7d5bb2c5cf7fc05aaa41561af321706ab5f'/>
<id>urn:sha1:5b7aa7d5bb2c5cf7fc05aaa41561af321706ab5f</id>
<content type='text'>
This was done in a v2 patch but v1 ended up being committed.  The
variable name is less confusing and stores the default behavior when no
matching exception exists.

Signed-off-by: Aristeu Rozanski &lt;aris@redhat.com&gt;
Cc: Dave Jones &lt;davej@redhat.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
Cc: James Morris &lt;jmorris@namei.org&gt;
Cc: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Acked-by: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Cc: Jiri Slaby &lt;jslaby@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>
</entry>
<entry>
<title>cgroup: fix invalid rcu dereference</title>
<updated>2012-10-25T21:37:52Z</updated>
<author>
<name>Jiri Slaby</name>
<email>jslaby@suse.cz</email>
</author>
<published>2012-10-25T20:37:34Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8c9506d16925f1b1314d93af383ca3134eb534d8'/>
<id>urn:sha1:8c9506d16925f1b1314d93af383ca3134eb534d8</id>
<content type='text'>
Commit ad676077a2ae ("device_cgroup: convert device_cgroup internally to
policy + exceptions") removed rcu locks which are needed in
task_devcgroup called in this chain:

  devcgroup_inode_mknod OR __devcgroup_inode_permission -&gt;
    __devcgroup_inode_permission -&gt;
      task_devcgroup -&gt;
        task_subsys_state -&gt;
          task_subsys_state_check.

Change the code so that task_devcgroup is safely called with rcu read
lock held.

  ===============================
  [ INFO: suspicious RCU usage. ]
  3.6.0-rc5-next-20120913+ #42 Not tainted
  -------------------------------
  include/linux/cgroup.h:553 suspicious rcu_dereference_check() usage!

  other info that might help us debug this:

  rcu_scheduler_active = 1, debug_locks = 0
  2 locks held by kdevtmpfs/23:
   #0:  (sb_writers){.+.+.+}, at: [&lt;ffffffff8116873f&gt;]
  mnt_want_write+0x1f/0x50
   #1:  (&amp;sb-&gt;s_type-&gt;i_mutex_key#3/1){+.+.+.}, at: [&lt;ffffffff811558af&gt;]
  kern_path_create+0x7f/0x170

  stack backtrace:
  Pid: 23, comm: kdevtmpfs Not tainted 3.6.0-rc5-next-20120913+ #42
  Call Trace:
    lockdep_rcu_suspicious+0xfd/0x130
    devcgroup_inode_mknod+0x19d/0x240
    vfs_mknod+0x71/0xf0
    handle_create.isra.2+0x72/0x200
    devtmpfsd+0x114/0x140
    ? handle_create.isra.2+0x200/0x200
    kthread+0xd6/0xe0
    kernel_thread_helper+0x4/0x10

Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Cc: Dave Jones &lt;davej@redhat.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
Cc: James Morris &lt;jmorris@namei.org&gt;
Cc: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Acked-by: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
