<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/security/device_cgroup.c, branch v3.11.1</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v3.11.1</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v3.11.1'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2013-05-24T01:55:38+00:00</updated>
<entry>
<title>device_cgroup: simplify cgroup tree walk in propagate_exception()</title>
<updated>2013-05-24T01:55:38+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2013-05-24T01:55:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d591fb56618f4f93160b477dfa25bbb1e31b0e85'/>
<id>urn:sha1:d591fb56618f4f93160b477dfa25bbb1e31b0e85</id>
<content type='text'>
During a config change, propagate_exception() needs to traverse the
subtree to update config on the subtree.  Because such config updates
need to allocate memory, it couldn't directly use
cgroup_for_each_descendant_pre() which required the whole iteration to
be contained in a single RCU read critical section.  To work around
the limitation, propagate_exception() built a linked list of
descendant cgroups while read-locking RCU and then walked the list
afterwards, which is safe as the whole iteration is protected by
devcgroup_mutex.  This works but is cumbersome.

With the recent updates, cgroup iterators now allow dropping RCU read
lock while iteration is in progress making this workaround no longer
necessary.  This patch replaces dev_cgroup-&gt;propagate_pending list and
get_online_devcg() with direct cgroup_for_each_descendant_pre() walk.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Aristeu Rozanski &lt;aris@redhat.com&gt;
Acked-by: Serge E. Hallyn &lt;serge.hallyn@ubuntu.com&gt;
Reviewed-by: Michal Hocko &lt;mhocko@suse.cz&gt;
</content>
</entry>
<entry>
<title>devcg: remove parent_cgroup.</title>
<updated>2013-04-18T18:34:35+00:00</updated>
<author>
<name>Rami Rosen</name>
<email>ramirose@gmail.com</email>
</author>
<published>2013-04-16T20:24:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e57d5cf2f894e3f2727f8cf74bed0bc81cae70c8'/>
<id>urn:sha1:e57d5cf2f894e3f2727f8cf74bed0bc81cae70c8</id>
<content type='text'>
In devcgroup_css_alloc(), there is no longer need for parent_cgroup.
bd2953ebbb("devcg: propagate local changes down the hierarchy") made
the variable parent_cgroup redundant. This patch removes parent_cgroup
from devcgroup_css_alloc().

Signed-off-by: Rami Rosen &lt;ramirose@gmail.com&gt;
Acked-by: Aristeu Rozanski &lt;aris@redhat.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>devcg: remove broken_hierarchy tag</title>
<updated>2013-04-08T15:31:59+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2013-04-07T17:25:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8adf12b0ffd0a10340bab355e586f8533a69630d'/>
<id>urn:sha1:8adf12b0ffd0a10340bab355e586f8533a69630d</id>
<content type='text'>
bd2953ebbb ("devcg: propagate local changes down the hierarchy")
implemented proper hierarchy support.  Remove the broken tag.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Aristeu Rozanski &lt;aris@redhat.com&gt;
</content>
</entry>
<entry>
<title>devcg: propagate local changes down the hierarchy</title>
<updated>2013-03-20T14:50:21+00:00</updated>
<author>
<name>Aristeu Rozanski</name>
<email>aris@redhat.com</email>
</author>
<published>2013-02-15T16:55:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bd2953ebbb533aeda9b86c82a53d5197a9a38f1b'/>
<id>urn:sha1:bd2953ebbb533aeda9b86c82a53d5197a9a38f1b</id>
<content type='text'>
This patch makes exception changes to propagate down in hierarchy respecting
when possible local exceptions.

New exceptions allowing additional access to devices won't be propagated, but
it'll be possible to add an exception to access all of part of the newly
allowed device(s).

New exceptions disallowing access to devices will be propagated down and the
local group's exceptions will be revalidated for the new situation.
Example:
      A
     / \
        B

    group        behavior          exceptions
    A            allow             "b 8:* rwm", "c 116:1 rw"
    B            deny              "c 1:3 rwm", "c 116:2 rwm", "b 3:* rwm"

If a new exception is added to group A:
	# echo "c 116:* r" &gt; A/devices.deny
it'll propagate down and after revalidating B's local exceptions, the exception
"c 116:2 rwm" will be removed.

In case parent's exceptions change and local exceptions are not allowed anymore,
they'll be deleted.

v7:
- do not allow behavior change when the cgroup has children
- update documentation

v6: fixed issues pointed by Serge Hallyn
- only copy parent's exceptions while propagating behavior if the local
  behavior is different
- while propagating exceptions, do not clear and copy parent's: it'd be against
  the premise we don't propagate access to more devices

v5: fixed issues pointed by Serge Hallyn
- updated documentation
- not propagating when an exception is written to devices.allow
- when propagating a new behavior, clean the local exceptions list if they're
  for a different behavior

v4: fixed issues pointed by Tejun Heo
- separated function to walk the tree and collect valid propagation targets

v3: fixed issues pointed by Tejun Heo
- update documentation
- move css_online/css_offline changes to a new patch
- use cgroup_for_each_descendant_pre() instead of own descendant walk
- move exception_copy rework to a separared patch
- move exception_clean rework to a separated patch

v2: fixed issues pointed by Tejun Heo
- instead of keeping the local settings that won't apply anymore, remove them

Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Signed-off-by: Aristeu Rozanski &lt;aris@redhat.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>devcg: use css_online and css_offline</title>
<updated>2013-03-20T14:50:17+00:00</updated>
<author>
<name>Aristeu Rozanski</name>
<email>aris@redhat.com</email>
</author>
<published>2013-02-15T16:55:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1909554c9715e4d032497993bb56f2726bfa89ae'/>
<id>urn:sha1:1909554c9715e4d032497993bb56f2726bfa89ae</id>
<content type='text'>
Allocate resources and change behavior only when online. This is needed in
order to determine if a node is suitable for hierarchy propagation or if it's
being removed.

Locking:
Both functions take devcgroup_mutex to make changes to device_cgroup structure.
Hierarchy propagation will also take devcgroup_mutex before walking the
tree while walking the tree itself is protected by rcu lock.

Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Signed-off-by: Aristeu Rozanski &lt;aris@redhat.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>devcg: prepare may_access() for hierarchy support</title>
<updated>2013-03-20T14:50:13+00:00</updated>
<author>
<name>Aristeu Rozanski</name>
<email>aris@redhat.com</email>
</author>
<published>2013-02-15T16:55:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c39a2a3018f8065cb5ea38b0314c1bbedb2cfa0d'/>
<id>urn:sha1:c39a2a3018f8065cb5ea38b0314c1bbedb2cfa0d</id>
<content type='text'>
Currently may_access() is only able to verify if an exception is valid for the
current cgroup, which has the same behavior. With hierarchy, it'll be also used
to verify if a cgroup local exception is valid towards its cgroup parent, which
might have different behavior.

v2:
- updated patch description
- rebased on top of a new patch to expand the may_access() logic to make it
  more clear
- fixed argument description order in may_access()

Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Signed-off-by: Aristeu Rozanski &lt;aris@redhat.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>devcg: expand may_access() logic</title>
<updated>2013-03-20T14:50:09+00:00</updated>
<author>
<name>Aristeu Rozanski</name>
<email>aris@redhat.com</email>
</author>
<published>2013-02-15T16:55:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=26898fdff371d78f122cf15d8732d1d37f2d1338'/>
<id>urn:sha1:26898fdff371d78f122cf15d8732d1d37f2d1338</id>
<content type='text'>
In order to make the next patch more clear, expand may_access() logic.

v2: may_access() returns bool now

Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Signed-off-by: Aristeu Rozanski &lt;aris@redhat.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>device_cgroup: don't grab mutex in rcu callback</title>
<updated>2013-02-22T01:22:15+00:00</updated>
<author>
<name>Jerry Snitselaar</name>
<email>jerry.snitselaar@oracle.com</email>
</author>
<published>2013-02-22T00:41:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/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:55+00:00</updated>
<author>
<name>Jerry Snitselaar</name>
<email>jerry.snitselaar@oracle.com</email>
</author>
<published>2013-01-17T08:04:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/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:38+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-11-19T16:13:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/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>
</feed>
