<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/security/smack, branch v4.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.0</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2015-02-22T16:38:40Z</updated>
<entry>
<title>Smack: Use d_is_positive() rather than testing dentry-&gt;d_inode</title>
<updated>2015-02-22T16:38:40Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2015-01-29T12:02:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8802565b605fc718046684f463845a1147f2fabd'/>
<id>urn:sha1:8802565b605fc718046684f463845a1147f2fabd</id>
<content type='text'>
Use d_is_positive() rather than testing dentry-&gt;d_inode in Smack to get rid of
direct references to d_inode outside of the VFS.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>Smack: secmark connections</title>
<updated>2015-02-11T20:55:05Z</updated>
<author>
<name>Casey Schaufler</name>
<email>casey@schaufler-ca.com</email>
</author>
<published>2015-02-11T20:52:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7f368ad34f0657f4bc39bf5bad6692b5a81a1194'/>
<id>urn:sha1:7f368ad34f0657f4bc39bf5bad6692b5a81a1194</id>
<content type='text'>
If the secmark is available us it on connection as
well as packet delivery.

Signed-off-by: Casey Schaufler &lt;casey@schaufler-ca.com&gt;
</content>
</entry>
<entry>
<title>Smack: Repair netfilter dependency</title>
<updated>2015-01-23T18:08:19Z</updated>
<author>
<name>Casey Schaufler</name>
<email>casey@schaufler-ca.com</email>
</author>
<published>2015-01-23T17:31:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=82b0b2c2b1e64ad6c5309a9eeba806af9812666b'/>
<id>urn:sha1:82b0b2c2b1e64ad6c5309a9eeba806af9812666b</id>
<content type='text'>
On 1/23/2015 8:20 AM, Jim Davis wrote:
&gt; Building with the attached random configuration file,
&gt;
&gt; security/smack/smack_netfilter.c: In function ‘smack_ipv4_output’:
&gt; security/smack/smack_netfilter.c:55:6: error: ‘struct sk_buff’ has no
&gt; member named ‘secmark’
&gt;    skb-&gt;secmark = skp-&gt;smk_secid;
&gt;       ^
&gt; make[2]: *** [security/smack/smack_netfilter.o] Error 1

The existing Makefile used the wrong configuration option to
determine if smack_netfilter should be built. This sets it right.

Signed-off-by: Casey Schaufler &lt;casey@schaufler-ca.com&gt;
</content>
</entry>
<entry>
<title>smack: fix possible use after frees in task_security() callers</title>
<updated>2015-01-21T19:56:53Z</updated>
<author>
<name>Andrey Ryabinin</name>
<email>a.ryabinin@samsung.com</email>
</author>
<published>2015-01-13T15:52:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6d1cff2a885850b78b40c34777b46cf5da5d1050'/>
<id>urn:sha1:6d1cff2a885850b78b40c34777b46cf5da5d1050</id>
<content type='text'>
We hit use after free on dereferncing pointer to task_smack struct in
smk_of_task() called from smack_task_to_inode().

task_security() macro uses task_cred_xxx() to get pointer to the task_smack.
task_cred_xxx() could be used only for non-pointer members of task's
credentials. It cannot be used for pointer members since what they point
to may disapper after dropping RCU read lock.

Mainly task_security() used this way:
	smk_of_task(task_security(p))

Intead of this introduce function smk_of_task_struct() which
takes task_struct as argument and returns pointer to smk_known struct
and do this under RCU read lock.
Bogus task_security() macro is not used anymore, so remove it.

KASan's report for this:

	AddressSanitizer: use after free in smack_task_to_inode+0x50/0x70 at addr c4635600
	=============================================================================
	BUG kmalloc-64 (Tainted: PO): kasan error
	-----------------------------------------------------------------------------

	Disabling lock debugging due to kernel taint
	INFO: Allocated in new_task_smack+0x44/0xd8 age=39 cpu=0 pid=1866
		kmem_cache_alloc_trace+0x88/0x1bc
		new_task_smack+0x44/0xd8
		smack_cred_prepare+0x48/0x21c
		security_prepare_creds+0x44/0x4c
		prepare_creds+0xdc/0x110
		smack_setprocattr+0x104/0x150
		security_setprocattr+0x4c/0x54
		proc_pid_attr_write+0x12c/0x194
		vfs_write+0x1b0/0x370
		SyS_write+0x5c/0x94
		ret_fast_syscall+0x0/0x48
	INFO: Freed in smack_cred_free+0xc4/0xd0 age=27 cpu=0 pid=1564
		kfree+0x270/0x290
		smack_cred_free+0xc4/0xd0
		security_cred_free+0x34/0x3c
		put_cred_rcu+0x58/0xcc
		rcu_process_callbacks+0x738/0x998
		__do_softirq+0x264/0x4cc
		do_softirq+0x94/0xf4
		irq_exit+0xbc/0x120
		handle_IRQ+0x104/0x134
		gic_handle_irq+0x70/0xac
		__irq_svc+0x44/0x78
		_raw_spin_unlock+0x18/0x48
		sync_inodes_sb+0x17c/0x1d8
		sync_filesystem+0xac/0xfc
		vdfs_file_fsync+0x90/0xc0
		vfs_fsync_range+0x74/0x7c
	INFO: Slab 0xd3b23f50 objects=32 used=31 fp=0xc4635600 flags=0x4080
	INFO: Object 0xc4635600 @offset=5632 fp=0x  (null)

	Bytes b4 c46355f0: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a  ZZZZZZZZZZZZZZZZ
	Object c4635600: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
	Object c4635610: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
	Object c4635620: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
	Object c4635630: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  kkkkkkkkkkkkkkk.
	Redzone c4635640: bb bb bb bb                                      ....
	Padding c46356e8: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a  ZZZZZZZZZZZZZZZZ
	Padding c46356f8: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
	CPU: 5 PID: 834 Comm: launchpad_prelo Tainted: PBO 3.10.30 #1
	Backtrace:
	[&lt;c00233a4&gt;] (dump_backtrace+0x0/0x158) from [&lt;c0023dec&gt;] (show_stack+0x20/0x24)
	 r7:c4634010 r6:d3b23f50 r5:c4635600 r4:d1002140
	[&lt;c0023dcc&gt;] (show_stack+0x0/0x24) from [&lt;c06d6d7c&gt;] (dump_stack+0x20/0x28)
	[&lt;c06d6d5c&gt;] (dump_stack+0x0/0x28) from [&lt;c01c1d50&gt;] (print_trailer+0x124/0x144)
	[&lt;c01c1c2c&gt;] (print_trailer+0x0/0x144) from [&lt;c01c1e88&gt;] (object_err+0x3c/0x44)
	 r7:c4635600 r6:d1002140 r5:d3b23f50 r4:c4635600
	[&lt;c01c1e4c&gt;] (object_err+0x0/0x44) from [&lt;c01cac18&gt;] (kasan_report_error+0x2b8/0x538)
	 r6:d1002140 r5:d3b23f50 r4:c6429cf8 r3:c09e1aa7
	[&lt;c01ca960&gt;] (kasan_report_error+0x0/0x538) from [&lt;c01c9430&gt;] (__asan_load4+0xd4/0xf8)
	[&lt;c01c935c&gt;] (__asan_load4+0x0/0xf8) from [&lt;c031e168&gt;] (smack_task_to_inode+0x50/0x70)
	 r5:c4635600 r4:ca9da000
	[&lt;c031e118&gt;] (smack_task_to_inode+0x0/0x70) from [&lt;c031af64&gt;] (security_task_to_inode+0x3c/0x44)
	 r5:cca25e80 r4:c0ba9780
	[&lt;c031af28&gt;] (security_task_to_inode+0x0/0x44) from [&lt;c023d614&gt;] (pid_revalidate+0x124/0x178)
	 r6:00000000 r5:cca25e80 r4:cbabe3c0 r3:00008124
	[&lt;c023d4f0&gt;] (pid_revalidate+0x0/0x178) from [&lt;c01db98c&gt;] (lookup_fast+0x35c/0x43y4)
	 r9:c6429efc r8:00000101 r7:c079d940 r6:c6429e90 r5:c6429ed8 r4:c83c4148
	[&lt;c01db630&gt;] (lookup_fast+0x0/0x434) from [&lt;c01deec8&gt;] (do_last.isra.24+0x1c0/0x1108)
	[&lt;c01ded08&gt;] (do_last.isra.24+0x0/0x1108) from [&lt;c01dff04&gt;] (path_openat.isra.25+0xf4/0x648)
	[&lt;c01dfe10&gt;] (path_openat.isra.25+0x0/0x648) from [&lt;c01e1458&gt;] (do_filp_open+0x3c/0x88)
	[&lt;c01e141c&gt;] (do_filp_open+0x0/0x88) from [&lt;c01ccb28&gt;] (do_sys_open+0xf0/0x198)
	 r7:00000001 r6:c0ea2180 r5:0000000b r4:00000000
	[&lt;c01cca38&gt;] (do_sys_open+0x0/0x198) from [&lt;c01ccc00&gt;] (SyS_open+0x30/0x34)
	[&lt;c01ccbd0&gt;] (SyS_open+0x0/0x34) from [&lt;c001db80&gt;] (ret_fast_syscall+0x0/0x48)
	Read of size 4 by thread T834:
	Memory state around the buggy address:
	 c4635380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	 c4635400: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
	 c4635480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	 c4635500: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
	 c4635580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	&gt;c4635600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
	           ^
	 c4635680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
	 c4635700: 00 00 00 00 04 fc fc fc fc fc fc fc fc fc fc fc
	 c4635780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	 c4635800: 00 00 00 00 00 00 04 fc fc fc fc fc fc fc fc fc
	 c4635880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	==================================================================

Signed-off-by: Andrey Ryabinin &lt;a.ryabinin@samsung.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
</content>
</entry>
<entry>
<title>smack: Add missing logging in bidirectional UDS connect check</title>
<updated>2015-01-21T00:35:31Z</updated>
<author>
<name>Rafal Krypa</name>
<email>r.krypa@samsung.com</email>
</author>
<published>2015-01-08T17:52:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=138a868f009bfca8633032cdb91e2b02e292658b'/>
<id>urn:sha1:138a868f009bfca8633032cdb91e2b02e292658b</id>
<content type='text'>
During UDS connection check, both sides are checked for write access to
the other side. But only the first check is performed with audit support.
The second one didn't produce any audit logs. This simple patch fixes that.

Signed-off-by: Rafal Krypa &lt;r.krypa@samsung.com&gt;
</content>
</entry>
<entry>
<title>Smack: secmark support for netfilter</title>
<updated>2015-01-21T00:34:25Z</updated>
<author>
<name>Casey Schaufler</name>
<email>casey@schaufler-ca.com</email>
</author>
<published>2014-12-13T01:08:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=69f287ae6fc8357e0bc561353a2d585b89ee8cdc'/>
<id>urn:sha1:69f287ae6fc8357e0bc561353a2d585b89ee8cdc</id>
<content type='text'>
Smack uses CIPSO to label internet packets and thus provide
for access control on delivery of packets. The netfilter facility
was not used to allow for Smack to work properly without netfilter
configuration. Smack does not need netfilter, however there are
cases where it would be handy.

As a side effect, the labeling of local IPv4 packets can be optimized
and the handling of local IPv6 packets is just all out better.

The best part is that the netfilter tools use "contexts" that
are just strings, and they work just as well for Smack as they
do for SELinux.

All of the conditional compilation for IPv6 was implemented
by Rafal Krypa &lt;r.krypa@samsung.com&gt;

Signed-off-by: Casey Schaufler &lt;casey@schaufler-ca.com&gt;
</content>
</entry>
<entry>
<title>Smack: Rework file hooks</title>
<updated>2015-01-21T00:32:17Z</updated>
<author>
<name>Casey Schaufler</name>
<email>casey@schaufler-ca.com</email>
</author>
<published>2014-12-13T01:19:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5e7270a6dd14fa6e3bb10128f200305b4a75f350'/>
<id>urn:sha1:5e7270a6dd14fa6e3bb10128f200305b4a75f350</id>
<content type='text'>
This is one of those cases where you look at code you did
years ago and wonder what you might have been thinking.
There are a number of LSM hooks that work off of file pointers,
and most of them really want the security data from the inode.
Some, however, really want the security context that the process
had when the file was opened. The difference went undetected in
Smack until it started getting used in a real system with real
testing. At that point it was clear that something was amiss.

This patch corrects the misuse of the f_security value in several
of the hooks. The behavior will not usually be any different, as
the process had to be able to open the file in the first place, and
the old check almost always succeeded, as will the new, but for
different reasons.

Thanks to the Samsung Tizen development team that identified this.

Signed-off-by: Casey Schaufler &lt;casey@schaufler-ca.com&gt;
</content>
</entry>
<entry>
<title>smack: Fix a bidirectional UDS connect check typo</title>
<updated>2015-01-19T18:00:05Z</updated>
<author>
<name>Zbigniew Jasinski</name>
<email>z.jasinski@samsung.com</email>
</author>
<published>2014-12-29T14:34:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=96be7b5424948ae39d29d5149eaec0bd6edd7404'/>
<id>urn:sha1:96be7b5424948ae39d29d5149eaec0bd6edd7404</id>
<content type='text'>
The 54e70ec5eb090193b03e69d551fa6771a5a217c4 commit introduced a
bidirectional check that should have checked for mutual WRITE access
between two labels. Due to a typo subject's OUT label is checked with
object's OUT. Should be OUT to IN.

Signed-off-by: Zbigniew Jasinski &lt;z.jasinski@samsung.com&gt;
</content>
</entry>
<entry>
<title>smack: introduce a special case for tmpfs in smack_d_instantiate()</title>
<updated>2015-01-19T17:58:02Z</updated>
<author>
<name>Łukasz Stelmach</name>
<email>l.stelmach@samsung.com</email>
</author>
<published>2014-12-16T15:53:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1d8c2326a4a2a4d942f9165b5702fe6f869ccf48'/>
<id>urn:sha1:1d8c2326a4a2a4d942f9165b5702fe6f869ccf48</id>
<content type='text'>
Files created with __shmem_file_stup() appear to have somewhat fake
dentries which make them look like root directories and not get
the label the current process or ("*") star meant for tmpfs files.

Signed-off-by: Łukasz Stelmach &lt;l.stelmach@samsung.com&gt;
</content>
</entry>
<entry>
<title>smack: fix logic in smack_inode_init_security function</title>
<updated>2015-01-19T17:18:11Z</updated>
<author>
<name>Lukasz Pawelczyk</name>
<email>l.pawelczyk@samsung.com</email>
</author>
<published>2014-11-26T14:31:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=68390ccf8b0a3470032f053d50379cfd49fbe952'/>
<id>urn:sha1:68390ccf8b0a3470032f053d50379cfd49fbe952</id>
<content type='text'>
In principle if this function was called with "value" == NULL and "len"
not NULL it could return different results for the "len" compared to a
case where "name" was not NULL. This is a hypothetical case that does
not exist in the kernel, but it's a logic bug nonetheless.

Signed-off-by: Lukasz Pawelczyk &lt;l.pawelczyk@samsung.com&gt;
</content>
</entry>
</feed>
