]> git.ipfire.org Git - people/ms/linux.git/commit
ARC: Fix 32-bit wrap around in access_ok()
authorVineet Gupta <vgupta@synopsys.com>
Thu, 26 Sep 2013 13:20:40 +0000 (18:50 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Oct 2013 17:54:56 +0000 (10:54 -0700)
commit7b081aded13f3437ed26e70e12f23aad69e68ad6
treed201df2c31cdba588eb9a6131796b2560289c572
parent49cac7d9e62954e2235ae342ee15e0e0a7995a16
ARC: Fix 32-bit wrap around in access_ok()

commit 0752adfda15f0eca9859a76da3db1800e129ad43 upstream.

Anton reported

 | LTP tests syscalls/process_vm_readv01 and process_vm_writev01 fail
 | similarly in one testcase test_iov_invalid -> lvec->iov_base.
 | Testcase expects errno EFAULT and return code -1,
 | but it gets return code 1 and ERRNO is 0 what means success.

Essentially test case was passing a pointer of -1 which access_ok()
was not catching. It was doing [@addr + @sz <= TASK_SIZE] which would
pass for @addr == -1

Fixed that by rewriting as [@addr <= TASK_SIZE - @sz]

Reported-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arc/include/asm/uaccess.h