diff options
author | kib <kib@FreeBSD.org> | 2009-09-20 12:40:56 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2009-09-20 12:40:56 +0000 |
commit | c04bcd30330134daaa9b565c074d3734231b4995 (patch) | |
tree | 1aa8bef2eec2f6cd86dbcaac76077172246d42bf /sys/vm | |
parent | 990095d3010293d553876c711f93d0928e2a8222 (diff) | |
download | FreeBSD-src-c04bcd30330134daaa9b565c074d3734231b4995.zip FreeBSD-src-c04bcd30330134daaa9b565c074d3734231b4995.tar.gz |
Old (a.out) rtld attempts to mmap zero-length region, e.g. when bss
of the linked object is zero-length. More old code assumes that mmap
of zero length returns success.
For a.out and pre-8 ELF binaries, allow the mmap of zero length.
Reported by: tegge
Reviewed by: tegge, alc, jhb
MFC after: 3 days
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_mmap.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 2b99e36..c8d25ee 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mount.h> #include <sys/conf.h> #include <sys/stat.h> +#include <sys/sysent.h> #include <sys/vmmeter.h> #include <sys/sysctl.h> @@ -229,7 +230,8 @@ mmap(td, uap) fp = NULL; /* make sure mapping fits into numeric range etc */ - if (uap->len == 0 || + if ((uap->len == 0 && !SV_CURPROC_FLAG(SV_AOUT) && + curproc->p_osrel >= 800104) || ((flags & MAP_ANON) && uap->fd != -1)) return (EINVAL); |