kernel/sys.c: fix stack memory content leak via UNAME26
authorKees Cook <keescook@chromium.org>
Fri, 19 Oct 2012 20:56:51 +0000 (13:56 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 30 Oct 2012 23:26:53 +0000 (23:26 +0000)
commit3042c7c2ee52f0ebfc8e09bc2c4cdbff3fc4ec61
tree5c3c3eaaee868586ae1c1631355b6618b9315928
parentcab128d34ceeff27e4c0bc0ffbff213a3baedb93
kernel/sys.c: fix stack memory content leak via UNAME26

commit 2702b1526c7278c4d65d78de209a465d4de2885e upstream.

Calling uname() with the UNAME26 personality set allows a leak of kernel
stack contents.  This fixes it by defensively calculating the length of
copy_to_user() call, making the len argument unsigned, and initializing
the stack buffer to zero (now technically unneeded, but hey, overkill).

CVE-2012-0957

Reported-by: PaX Team <pageexec@freemail.hu>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: PaX Team <pageexec@freemail.hu>
Cc: Brad Spengler <spender@grsecurity.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
kernel/sys.c