sys: don't hold uts_sem while accessing userspace memory
authorJann Horn <jannh@google.com>
Mon, 25 Jun 2018 16:34:10 +0000 (18:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Sep 2018 17:56:00 +0000 (19:56 +0200)
commitb692c405a1ae577b44764351ad80e99e0a08be99
tree8c781ba3ee2a99a62ce743034e39dac5efa6d439
parentc2ea292b13509ebb79a1a80c72d0b28d4e5a48db
sys: don't hold uts_sem while accessing userspace memory

commit 42a0cc3478584d4d63f68f2f5af021ddbea771fa upstream.

Holding uts_sem as a writer while accessing userspace memory allows a
namespace admin to stall all processes that attempt to take uts_sem.
Instead, move data through stack buffers and don't access userspace memory
while uts_sem is held.

Cc: stable@vger.kernel.org
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/alpha/kernel/osf_sys.c
arch/sparc/kernel/sys_sparc_32.c
arch/sparc/kernel/sys_sparc_64.c
kernel/sys.c
kernel/utsname_sysctl.c