diff options
author | jhb <jhb@FreeBSD.org> | 2014-09-15 17:20:13 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2014-09-15 17:20:13 +0000 |
commit | bd469e35e2c16df13b7c77d6193bb81ec0f600f6 (patch) | |
tree | 93c8cc057b6c3ff7c23527608d6183ae01cc9bbb /lib/libc/sys/mmap.2 | |
parent | 17021239d9d97ea75b0e7eb686bdccc78175565d (diff) | |
download | FreeBSD-src-bd469e35e2c16df13b7c77d6193bb81ec0f600f6.zip FreeBSD-src-bd469e35e2c16df13b7c77d6193bb81ec0f600f6.tar.gz |
Add stricter checking of some mmap() arguments:
- Fail with EINVAL if an invalid protection mask is passed to mmap().
- Fail with EINVAL if an unknown flag is passed to mmap().
- Fail with EINVAL if both MAP_PRIVATE and MAP_SHARED are passed to mmap().
- Require one of either MAP_PRIVATE or MAP_SHARED for non-anonymous
mappings.
Reviewed by: alc, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D698
Diffstat (limited to 'lib/libc/sys/mmap.2')
-rw-r--r-- | lib/libc/sys/mmap.2 | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/libc/sys/mmap.2 b/lib/libc/sys/mmap.2 index 3dd8303..4a561ea 100644 --- a/lib/libc/sys/mmap.2 +++ b/lib/libc/sys/mmap.2 @@ -28,7 +28,7 @@ .\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 .\" $FreeBSD$ .\" -.Dd June 19, 2014 +.Dd September 15, 2014 .Dt MMAP 2 .Os .Sh NAME @@ -372,6 +372,29 @@ The argument is not a valid open file descriptor. .It Bq Er EINVAL +An invalid value was passed in the +.Fa prot +argument. +.It Bq Er EINVAL +An undefined option was set in the +.Fa flags +argument. +.It Bq Er EINVAL +Both +.Dv MAP_PRIVATE +and +.Dv MAP_SHARED +were specified. +.It Bq Er EINVAL +None of +.Dv MAP_ANON , +.Dv MAP_PRIVATE , +.Dv MAP_SHARED , +or +.Dv MAP_STACK +was specified. +At least one of these flags must be included. +.It Bq Er EINVAL .Dv MAP_FIXED was specified and the .Fa addr |