aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>2013-09-11 17:23:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 18:58:18 -0400
commit3ddc5b46a8e90f3c9251338b60191d0a804b0d92 (patch)
tree5c76cd730cb94e75f30953d6cd1aed9386fcee37 /arch/alpha
parent20d0e57017b69e7e4ae7166c43f3a3f023ab9702 (diff)
kernel-wide: fix missing validations on __get/__put/__copy_to/__copy_from_user()
I found the following pattern that leads in to interesting findings: grep -r "ret.*|=.*__put_user" * grep -r "ret.*|=.*__get_user" * grep -r "ret.*|=.*__copy" * The __put_user() calls in compat_ioctl.c, ptrace compat, signal compat, since those appear in compat code, we could probably expect the kernel addresses not to be reachable in the lower 32-bit range, so I think they might not be exploitable. For the "__get_user" cases, I don't think those are exploitable: the worse that can happen is that the kernel will copy kernel memory into in-kernel buffers, and will fail immediately afterward. The alpha csum_partial_copy_from_user() seems to be missing the access_ok() check entirely. The fix is inspired from x86. This could lead to information leak on alpha. I also noticed that many architectures map csum_partial_copy_from_user() to csum_partial_copy_generic(), but I wonder if the latter is performing the access checks on every architectures. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Matt Turner <mattst88@gmail.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Oleg Nesterov <oleg@redhat.com> Cc: David Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/alpha')
-rw-r--r--arch/alpha/lib/csum_partial_copy.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/alpha/lib/csum_partial_copy.c b/arch/alpha/lib/csum_partial_copy.c
index 40736da9bea8..ffb19b7da999 100644
--- a/arch/alpha/lib/csum_partial_copy.c
+++ b/arch/alpha/lib/csum_partial_copy.c
@@ -338,6 +338,11 @@ csum_partial_copy_from_user(const void __user *src, void *dst, int len,
338 unsigned long doff = 7 & (unsigned long) dst; 338 unsigned long doff = 7 & (unsigned long) dst;
339 339
340 if (len) { 340 if (len) {
341 if (!access_ok(VERIFY_READ, src, len)) {
342 *errp = -EFAULT;
343 memset(dst, 0, len);
344 return sum;
345 }
341 if (!doff) { 346 if (!doff) {
342 if (!soff) 347 if (!soff)
343 checksum = csum_partial_cfu_aligned( 348 checksum = csum_partial_cfu_aligned(