<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/security, branch v3.4.74</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/security?h=v3.4.74</id>
<link rel='self' href='https://git.amat.us/linux/atom/security?h=v3.4.74'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2013-12-04T18:50:32Z</updated>
<entry>
<title>selinux: correct locking in selinux_netlbl_socket_connect)</title>
<updated>2013-12-04T18:50:32Z</updated>
<author>
<name>Paul Moore</name>
<email>pmoore@redhat.com</email>
</author>
<published>2013-09-26T21:00:46Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=17af9d91523a6e44a3721cea48cd3ade66a8b416'/>
<id>urn:sha1:17af9d91523a6e44a3721cea48cd3ade66a8b416</id>
<content type='text'>
commit 42d64e1add3a1ce8a787116036163b8724362145 upstream.

The SELinux/NetLabel glue code has a locking bug that affects systems
with NetLabel enabled, see the kernel error message below.  This patch
corrects this problem by converting the bottom half socket lock to a
more conventional, and correct for this call-path, lock_sock() call.

 ===============================
 [ INFO: suspicious RCU usage. ]
 3.11.0-rc3+ #19 Not tainted
 -------------------------------
 net/ipv4/cipso_ipv4.c:1928 suspicious rcu_dereference_protected() usage!

 other info that might help us debug this:

 rcu_scheduler_active = 1, debug_locks = 0
 2 locks held by ping/731:
  #0:  (slock-AF_INET/1){+.-...}, at: [...] selinux_netlbl_socket_connect
  #1:  (rcu_read_lock){.+.+..}, at: [&lt;...&gt;] netlbl_conn_setattr

 stack backtrace:
 CPU: 1 PID: 731 Comm: ping Not tainted 3.11.0-rc3+ #19
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
  0000000000000001 ffff88006f659d28 ffffffff81726b6a ffff88003732c500
  ffff88006f659d58 ffffffff810e4457 ffff88006b845a00 0000000000000000
  000000000000000c ffff880075aa2f50 ffff88006f659d90 ffffffff8169bec7
 Call Trace:
  [&lt;ffffffff81726b6a&gt;] dump_stack+0x54/0x74
  [&lt;ffffffff810e4457&gt;] lockdep_rcu_suspicious+0xe7/0x120
  [&lt;ffffffff8169bec7&gt;] cipso_v4_sock_setattr+0x187/0x1a0
  [&lt;ffffffff8170f317&gt;] netlbl_conn_setattr+0x187/0x190
  [&lt;ffffffff8170f195&gt;] ? netlbl_conn_setattr+0x5/0x190
  [&lt;ffffffff8131ac9e&gt;] selinux_netlbl_socket_connect+0xae/0xc0
  [&lt;ffffffff81303025&gt;] selinux_socket_connect+0x135/0x170
  [&lt;ffffffff8119d127&gt;] ? might_fault+0x57/0xb0
  [&lt;ffffffff812fb146&gt;] security_socket_connect+0x16/0x20
  [&lt;ffffffff815d3ad3&gt;] SYSC_connect+0x73/0x130
  [&lt;ffffffff81739a85&gt;] ? sysret_check+0x22/0x5d
  [&lt;ffffffff810e5e2d&gt;] ? trace_hardirqs_on_caller+0xfd/0x1c0
  [&lt;ffffffff81373d4e&gt;] ? trace_hardirqs_on_thunk+0x3a/0x3f
  [&lt;ffffffff815d52be&gt;] SyS_connect+0xe/0x10
  [&lt;ffffffff81739a59&gt;] system_call_fastpath+0x16/0x1b

Signed-off-by: Paul Moore &lt;pmoore@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Revert "ima: policy for RAMFS"</title>
<updated>2013-11-29T18:50:34Z</updated>
<author>
<name>Mimi Zohar</name>
<email>zohar@linux.vnet.ibm.com</email>
</author>
<published>2013-10-17T11:34:02Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7288f91dd5b55d82e1dee9f0d24e9f4730d57392'/>
<id>urn:sha1:7288f91dd5b55d82e1dee9f0d24e9f4730d57392</id>
<content type='text'>
commit 08de59eb144d7c41351a467442f898d720f0f15f upstream.

This reverts commit 4c2c392763a682354fac65b6a569adec4e4b5387.

Everything in the initramfs should be measured and appraised,
but until the initramfs has extended attribute support, at
least measured.

Signed-off-by: Mimi Zohar &lt;zohar@us.ibm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>key: Fix resource leak</title>
<updated>2013-03-28T19:12:27Z</updated>
<author>
<name>Alan Cox</name>
<email>alan@linux.intel.com</email>
</author>
<published>2012-09-28T11:20:02Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b647ebe6e7c171efd2003b1a8d07dcc26e6fa748'/>
<id>urn:sha1:b647ebe6e7c171efd2003b1a8d07dcc26e6fa748</id>
<content type='text'>
commit a84a921978b7d56e0e4b87ffaca6367429b4d8ff upstream.

On an error iov may still have been reallocated and need freeing

Signed-off-by: Alan Cox &lt;alan@linux.intel.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>selinux: use GFP_ATOMIC under spin_lock</title>
<updated>2013-03-20T20:05:00Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2013-03-16T09:48:11Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8c97feb5edd118fe633ed29773c599536d562d43'/>
<id>urn:sha1:8c97feb5edd118fe633ed29773c599536d562d43</id>
<content type='text'>
commit 4502403dcf8f5c76abd4dbab8726c8e4ecb5cd34 upstream.

The call tree here is:

sk_clone_lock()              &lt;- takes bh_lock_sock(newsk);
xfrm_sk_clone_policy()
__xfrm_sk_clone_policy()
clone_policy()               &lt;- uses GFP_ATOMIC for allocations
security_xfrm_policy_clone()
security_ops-&gt;xfrm_policy_clone_security()
selinux_xfrm_policy_clone()

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: James Morris &lt;james.l.morris@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Fix: compat_rw_copy_check_uvector() misuse in aio, readv, writev, and security keys</title>
<updated>2013-03-14T18:29:51Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2013-02-25T15:20:36Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3126603e01babcec7cfe2f284099e2adff095bff'/>
<id>urn:sha1:3126603e01babcec7cfe2f284099e2adff095bff</id>
<content type='text'>
commit 8aec0f5d4137532de14e6554fd5dd201ff3a3c49 upstream.

Looking at mm/process_vm_access.c:process_vm_rw() and comparing it to
compat_process_vm_rw() shows that the compatibility code requires an
explicit "access_ok()" check before calling
compat_rw_copy_check_uvector(). The same difference seems to appear when
we compare fs/read_write.c:do_readv_writev() to
fs/compat.c:compat_do_readv_writev().

This subtle difference between the compat and non-compat requirements
should probably be debated, as it seems to be error-prone. In fact,
there are two others sites that use this function in the Linux kernel,
and they both seem to get it wrong:

Now shifting our attention to fs/aio.c, we see that aio_setup_iocb()
also ends up calling compat_rw_copy_check_uvector() through
aio_setup_vectored_rw(). Unfortunately, the access_ok() check appears to
be missing. Same situation for
security/keys/compat.c:compat_keyctl_instantiate_key_iov().

I propose that we add the access_ok() check directly into
compat_rw_copy_check_uvector(), so callers don't have to worry about it,
and it therefore makes the compat call code similar to its non-compat
counterpart. Place the access_ok() check in the same location where
copy_from_user() can trigger a -EFAULT error in the non-compat code, so
the ABI behaviors are alike on both compat and non-compat.

While we are here, fix compat_do_readv_writev() so it checks for
compat_rw_copy_check_uvector() negative return values.

And also, fix a memory leak in compat_keyctl_instantiate_key_iov() error
handling.

Acked-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Acked-by: Al Viro &lt;viro@ZenIV.linux.org.uk&gt;
Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>keys: fix race with concurrent install_user_keyrings()</title>
<updated>2013-03-14T18:29:51Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2013-03-12T05:44:31Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=96ace773358d2989ea522a1cdccf65d75c1335f3'/>
<id>urn:sha1:96ace773358d2989ea522a1cdccf65d75c1335f3</id>
<content type='text'>
commit 0da9dfdd2cd9889201bc6f6f43580c99165cd087 upstream.

This fixes CVE-2013-1792.

There is a race in install_user_keyrings() that can cause a NULL pointer
dereference when called concurrently for the same user if the uid and
uid-session keyrings are not yet created.  It might be possible for an
unprivileged user to trigger this by calling keyctl() from userspace in
parallel immediately after logging in.

Assume that we have two threads both executing lookup_user_key(), both
looking for KEY_SPEC_USER_SESSION_KEYRING.

	THREAD A			THREAD B
	===============================	===============================
					==&gt;call install_user_keyrings();
	if (!cred-&gt;user-&gt;session_keyring)
	==&gt;call install_user_keyrings()
					...
					user-&gt;uid_keyring = uid_keyring;
	if (user-&gt;uid_keyring)
		return 0;
	&lt;==
	key = cred-&gt;user-&gt;session_keyring [== NULL]
					user-&gt;session_keyring = session_keyring;
	atomic_inc(&amp;key-&gt;usage); [oops]

At the point thread A dereferences cred-&gt;user-&gt;session_keyring, thread B
hasn't updated user-&gt;session_keyring yet, but thread A assumes it is
populated because install_user_keyrings() returned ok.

The race window is really small but can be exploited if, for example,
thread B is interrupted or preempted after initializing uid_keyring, but
before doing setting session_keyring.

This couldn't be reproduced on a stock kernel.  However, after placing
systemtap probe on 'user-&gt;session_keyring = session_keyring;' that
introduced some delay, the kernel could be crashed reliably.

Fix this by checking both pointers before deciding whether to return.
Alternatively, the test could be done away with entirely as it is checked
inside the mutex - but since the mutex is global, that may not be the best
way.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Reported-by: Mateusz Guzik &lt;mguzik@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: James Morris &lt;james.l.morris@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>evm: checking if removexattr is not a NULL</title>
<updated>2013-01-28T04:47:43Z</updated>
<author>
<name>Dmitry Kasatkin</name>
<email>dmitry.kasatkin@intel.com</email>
</author>
<published>2013-01-18T21:56:39Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9c5f1b49341154b579851425dabb32cb3aa9b5db'/>
<id>urn:sha1:9c5f1b49341154b579851425dabb32cb3aa9b5db</id>
<content type='text'>
commit a67adb997419fb53540d4a4f79c6471c60bc69b6 upstream.

The following lines of code produce a kernel oops.

fd = socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
fchmod(fd, 0666);

[  139.922364] BUG: unable to handle kernel NULL pointer dereference at   (null)
[  139.924982] IP: [&lt;  (null)&gt;]   (null)
[  139.924982] *pde = 00000000
[  139.924982] Oops: 0000 [#5] SMP
[  139.924982] Modules linked in: fuse dm_crypt dm_mod i2c_piix4 serio_raw evdev binfmt_misc button
[  139.924982] Pid: 3070, comm: acpid Tainted: G      D      3.8.0-rc2-kds+ #465 Bochs Bochs
[  139.924982] EIP: 0060:[&lt;00000000&gt;] EFLAGS: 00010246 CPU: 0
[  139.924982] EIP is at 0x0
[  139.924982] EAX: cf5ef000 EBX: cf5ef000 ECX: c143d600 EDX: c15225f2
[  139.924982] ESI: cf4d2a1c EDI: cf4d2a1c EBP: cc02df10 ESP: cc02dee4
[  139.924982]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[  139.924982] CR0: 80050033 CR2: 00000000 CR3: 0c059000 CR4: 000006d0
[  139.924982] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[  139.924982] DR6: ffff0ff0 DR7: 00000400
[  139.924982] Process acpid (pid: 3070, ti=cc02c000 task=d7705340 task.ti=cc02c000)
[  139.924982] Stack:
[  139.924982]  c1203c88 00000000 cc02def4 cf4d2a1c ae21eefa 471b60d5 1083c1ba c26a5940
[  139.924982]  e891fb5e 00000041 00000004 cc02df1c c1203964 00000000 cc02df4c c10e20c3
[  139.924982]  00000002 00000000 00000000 22222222 c1ff2222 cf5ef000 00000000 d76efb08
[  139.924982] Call Trace:
[  139.924982]  [&lt;c1203c88&gt;] ? evm_update_evmxattr+0x5b/0x62
[  139.924982]  [&lt;c1203964&gt;] evm_inode_post_setattr+0x22/0x26
[  139.924982]  [&lt;c10e20c3&gt;] notify_change+0x25f/0x281
[  139.924982]  [&lt;c10cbf56&gt;] chmod_common+0x59/0x76
[  139.924982]  [&lt;c10e27a1&gt;] ? put_unused_fd+0x33/0x33
[  139.924982]  [&lt;c10cca09&gt;] sys_fchmod+0x39/0x5c
[  139.924982]  [&lt;c13f4f30&gt;] syscall_call+0x7/0xb
[  139.924982] Code:  Bad EIP value.

This happens because sockets do not define the removexattr operation.
Before removing the xattr, verify the removexattr function pointer is
not NULL.

Signed-off-by: Dmitry Kasatkin &lt;dmitry.kasatkin@intel.com&gt;
Signed-off-by: Mimi Zohar &lt;zohar@linux.vnet.ibm.com&gt;
Signed-off-by: James Morris &lt;james.l.morris@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>selinux: fix sel_netnode_insert() suspicious rcu dereference</title>
<updated>2012-11-26T19:38:02Z</updated>
<author>
<name>Dave Jones</name>
<email>davej@redhat.com</email>
</author>
<published>2012-11-09T00:09:27Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=55649211861616c26aa25c9e710c5691837975e4'/>
<id>urn:sha1:55649211861616c26aa25c9e710c5691837975e4</id>
<content type='text'>
commit 88a693b5c1287be4da937699cb82068ce9db0135 upstream.

===============================
[ INFO: suspicious RCU usage. ]
3.5.0-rc1+ #63 Not tainted
-------------------------------
security/selinux/netnode.c:178 suspicious rcu_dereference_check() usage!

other info that might help us debug this:

rcu_scheduler_active = 1, debug_locks = 0
1 lock held by trinity-child1/8750:
 #0:  (sel_netnode_lock){+.....}, at: [&lt;ffffffff812d8f8a&gt;] sel_netnode_sid+0x16a/0x3e0

stack backtrace:
Pid: 8750, comm: trinity-child1 Not tainted 3.5.0-rc1+ #63
Call Trace:
 [&lt;ffffffff810cec2d&gt;] lockdep_rcu_suspicious+0xfd/0x130
 [&lt;ffffffff812d91d1&gt;] sel_netnode_sid+0x3b1/0x3e0
 [&lt;ffffffff812d8e20&gt;] ? sel_netnode_find+0x1a0/0x1a0
 [&lt;ffffffff812d24a6&gt;] selinux_socket_bind+0xf6/0x2c0
 [&lt;ffffffff810cd1dd&gt;] ? trace_hardirqs_off+0xd/0x10
 [&lt;ffffffff810cdb55&gt;] ? lock_release_holdtime.part.9+0x15/0x1a0
 [&lt;ffffffff81093841&gt;] ? lock_hrtimer_base+0x31/0x60
 [&lt;ffffffff812c9536&gt;] security_socket_bind+0x16/0x20
 [&lt;ffffffff815550ca&gt;] sys_bind+0x7a/0x100
 [&lt;ffffffff816c03d5&gt;] ? sysret_check+0x22/0x5d
 [&lt;ffffffff810d392d&gt;] ? trace_hardirqs_on_caller+0x10d/0x1a0
 [&lt;ffffffff8133b09e&gt;] ? trace_hardirqs_on_thunk+0x3a/0x3f
 [&lt;ffffffff816c03a9&gt;] system_call_fastpath+0x16/0x1b

This patch below does what Paul McKenney suggested in the previous thread.

Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
Reviewed-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Acked-by: Paul Moore &lt;paul@paul-moore.com&gt;
Cc: Eric Paris &lt;eparis@parisplace.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: James Morris &lt;james.l.morris@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Yama: handle 32-bit userspace prctl</title>
<updated>2012-10-07T15:32:28Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2012-08-27T18:38:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7d0fcfec4c491eb3c815929be5512ae8d1886553'/>
<id>urn:sha1:7d0fcfec4c491eb3c815929be5512ae8d1886553</id>
<content type='text'>
commit 2e4930eb7c8fb20a39dfb5f8a8f80402710dcea8 upstream.

When running a 64-bit kernel and receiving prctls from a 32-bit
userspace, the "-1" used as an unsigned long will end up being
misdetected. The kernel is looking for 0xffffffffffffffff instead of
0xffffffff. Since prctl lacks a distinct compat interface, Yama needs
to handle this translation itself. As such, support either value as
meaning PR_SET_PTRACER_ANY, to avoid breaking the ABI for 64-bit.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: John Johansen &lt;john.johansen@canonical.com&gt;
Signed-off-by: James Morris &lt;james.l.morris@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>posix_types.h: Cleanup stale __NFDBITS and related definitions</title>
<updated>2012-08-09T15:31:39Z</updated>
<author>
<name>Josh Boyer</name>
<email>jwboyer@redhat.com</email>
</author>
<published>2012-07-25T14:40:34Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=27cd8f51344dcf4799c7a092c1797402b833126a'/>
<id>urn:sha1:27cd8f51344dcf4799c7a092c1797402b833126a</id>
<content type='text'>
commit 8ded2bbc1845e19c771eb55209aab166ef011243 upstream.

Recently, glibc made a change to suppress sign-conversion warnings in
FD_SET (glibc commit ceb9e56b3d1).  This uncovered an issue with the
kernel's definition of __NFDBITS if applications #include
&lt;linux/types.h&gt; after including &lt;sys/select.h&gt;.  A build failure would
be seen when passing the -Werror=sign-compare and -D_FORTIFY_SOURCE=2
flags to gcc.

It was suggested that the kernel should either match the glibc
definition of __NFDBITS or remove that entirely.  The current in-kernel
uses of __NFDBITS can be replaced with BITS_PER_LONG, and there are no
uses of the related __FDELT and __FDMASK defines.  Given that, we'll
continue the cleanup that was started with commit 8b3d1cda4f5f
("posix_types: Remove fd_set macros") and drop the remaining unused
macros.

Additionally, linux/time.h has similar macros defined that expand to
nothing so we'll remove those at the same time.

Reported-by: Jeff Law &lt;law@redhat.com&gt;
Suggested-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Josh Boyer &lt;jwboyer@redhat.com&gt;
[ .. and fix up whitespace as per akpm ]
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
