Konstantin Belousov wrote:
> Author: kib
> Date: Sun Sep 20 12:40:56 2009
> New Revision: 197348
> URL: http://svn.freebsd.org/changeset/base/197348
> 
> Log:
>   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
> 
> Modified:
>   head/sys/vm/vm_mmap.c
> 
> Modified: head/sys/vm/vm_mmap.c
> ==============================================================================
> --- head/sys/vm/vm_mmap.c     Sun Sep 20 12:24:55 2009        (r197347)
> +++ head/sys/vm/vm_mmap.c     Sun Sep 20 12:40:56 2009        (r197348)
> @@ -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);
>  
> 
> 

This hack needs a comment.

        Sam

_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to