summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-03-21 21:37:33 +0000
committerjhb <jhb@FreeBSD.org>2016-03-21 21:37:33 +0000
commit6f8f2fe58616ae4446066288b54bcca96eac69be (patch)
tree58c8cd3e864cd6a4c77d7330aab43fbe2a866af1 /lib/libc
parent9910a5676808ff2a0ab221ab7f36404a7ee5dd90 (diff)
downloadFreeBSD-src-6f8f2fe58616ae4446066288b54bcca96eac69be.zip
FreeBSD-src-6f8f2fe58616ae4446066288b54bcca96eac69be.tar.gz
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.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sys/aio_return.24
-rw-r--r--lib/libc/sys/aio_waitcomplete.24
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/sys/aio_return.2 b/lib/libc/sys/aio_return.2
index 2ef6c25..df55873 100644
--- a/lib/libc/sys/aio_return.2
+++ b/lib/libc/sys/aio_return.2
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 7, 2006
+.Dd March 21, 2016
.Dt AIO_RETURN 2
.Os
.Sh NAME
@@ -34,7 +34,7 @@
.Lb libc
.Sh SYNOPSIS
.In aio.h
-.Ft int
+.Ft ssize_t
.Fn aio_return "struct aiocb *iocb"
.Sh DESCRIPTION
The
diff --git a/lib/libc/sys/aio_waitcomplete.2 b/lib/libc/sys/aio_waitcomplete.2
index 885b3d7..66e7208 100644
--- a/lib/libc/sys/aio_waitcomplete.2
+++ b/lib/libc/sys/aio_waitcomplete.2
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 19, 2000
+.Dd March 21, 2016
.Dt AIO_WAITCOMPLETE 2
.Os
.Sh NAME
@@ -34,7 +34,7 @@
.Lb libc
.Sh SYNOPSIS
.In aio.h
-.Ft int
+.Ft ssize_t
.Fn aio_waitcomplete "struct aiocb **iocbp" "struct timespec *timeout"
.Sh DESCRIPTION
The
OpenPOWER on IntegriCloud