DescriptionEugene Teo (Security Response)
2010-09-02 01:48:50 UTC
Description of problem:
This doesn't look correct, the io_submit systemcall calls do_io_submit() directly:
SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr,
struct iocb __user * __user *, iocbpp)
{
return do_io_submit(ctx_id, nr, iocbpp, 0);
}
do_io_submit only checks if nr < 0, but doesnt check if the access_ok
multiplication will overflow.
long do_io_submit(aio_context_t ctx_id, long nr,
struct iocb __user *__user *iocbpp, bool compat)
{
...
if (unlikely(!access_ok(VERIFY_READ, iocbpp, (nr*sizeof(*iocbpp)))))
return -EFAULT;
...
Then it uses this loop with __get_user_nocheck(), which doesn't look safe.
...
for (i=0; i<nr; i++) {
struct iocb __user *user_iocb;
struct iocb tmp;
if (unlikely(__get_user(user_iocb, iocbpp + i))) {
ret = -EFAULT;
break;
}
...
Acknowledgements:
Red Hat would like to thank Tavis Ormandy for reporting this issue.