svn commit: r297167 - in head: lib/libc/sys sys/kern sys/sys tests/sys/aio

John Baldwin jhb at freebsd.org
Mon Mar 21 22:36:10 UTC 2016


On Monday, March 21, 2016 09:37:33 PM John Baldwin wrote:
> Author: jhb
> Date: Mon Mar 21 21:37:33 2016
> New Revision: 297167
> URL: https://svnweb.freebsd.org/changeset/base/297167
> 
> Log:
>   Fully handle size_t lengths in AIO requests.
>   
>   First, update the return types of aio_return() and aio_waitcomplete() to
>   ssize_t.
>   
>   POSIX requires aio_return() to return a ssize_t so that it can represent
>   all return values from read() and write().  aio_waitcomplete() should use
>   ssize_t for the same reason.
>   
>   aio_return() has used ssize_t in <aio.h> since r31620 but the manpage and
>   system call entry were not updated.  aio_waitcomplete() has always
>   returned int.
>   
>   Note that this does not require new system call stubs as this is
>   effectively only an API change in how the compiler interprets the return
>   value.
>   
>   Second, allow aio_nbytes values up to IOSIZE_MAX instead of just INT_MAX.
>   
>   aio_read/write should now honor the same length limits as normal read/write.
>   
>   Third, use longs instead of ints in the aio_return() and aio_waitcomplete()
>   system call functions so that the 64-bit size_t in the in-kernel aiocb
>   isn't truncated to 32-bits before being copied out to userland or
>   being returned.
>   
>   Finally, a simple test has been added to verify the bounds checking on the
>   maximum read size from a file.

Oops, missed the metadata:

Reviewed by:		kib (not the test, I added that later)
Sponsored by:		Chelsio
Differential Revision:		https://reviews.freebsd.org/D5679

-- 
John Baldwin


More information about the svn-src-all mailing list