aio: fix the compat vectored operations
commit64857a8ea697a9813bceb43f108a19c832215c8f
authorJeff Moyer <jmoyer@redhat.com>
Wed, 26 May 2010 21:44:26 +0000 (26 14:44 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:22:35 +0000 (5 11:22 -0700)
tree570d8a8aa0c656fbc9ac45c76457e65389098f8e
parent693b478a85a8732c4a76ad3c188be928a08eda68
aio: fix the compat vectored operations

commit 9d85cba718efeef9ca00ce3f7f34f5880737aa9b upstream.

The aio compat code was not converting the struct iovecs from 32bit to
64bit pointers, causing either EINVAL to be returned from io_getevents, or
EFAULT as the result of the I/O.  This patch passes a compat flag to
io_submit to signal that pointer conversion is necessary for a given iocb
array.

A variant of this was tested by Michael Tokarev.  I have also updated the
libaio test harness to exercise this code path with good success.
Further, I grabbed a copy of ltp and ran the
testcases/kernel/syscall/readv and writev tests there (compiled with -m32
on my 64bit system).  All seems happy, but extra eyes on this would be
welcome.

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix CONFIG_COMPAT=n build]
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Cc: Zach Brown <zach.brown@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/aio.c
fs/compat.c
include/linux/aio.h