qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] mmap: add check if requested memory area fits t


From: Aurelien Jarno
Subject: Re: [Qemu-devel] [PATCH] mmap: add check if requested memory area fits target address space
Date: Mon, 8 Dec 2008 19:16:39 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, Dec 03, 2008 at 01:29:43PM +0200, Kirill A. Shutemov wrote:
> Signed-off-by: Kirill A. Shutemov <address@hidden>

Applied, thanks.

> ---
>  linux-user/mmap.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/linux-user/mmap.c b/linux-user/mmap.c
> index d96917d..52e2dc8 100644
> --- a/linux-user/mmap.c
> +++ b/linux-user/mmap.c
> @@ -389,6 +389,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int 
> prot,
>          end = start + len;
>          real_end = HOST_PAGE_ALIGN(end);
>  
> +     /*
> +      * Test if requested memory area fits target address space
> +      * It can fail only on 64-bit host with 32-bit target.
> +      * On any other target/host host mmap() handles this error correctly.
> +      */
> +        if ((unsigned long)start + len - 1 > (abi_ulong) -1) {
> +            errno = EINVAL;
> +            goto fail;
> +        }
> +
>          for(addr = real_start; addr < real_end; addr += TARGET_PAGE_SIZE) {
>              flg = page_get_flags(addr);
>              if (flg & PAGE_RESERVED) {
> -- 
> 1.6.0.2.GIT
> 
> 
> 
> 

-- 
  .''`.  Aurelien Jarno             | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   address@hidden         | address@hidden
   `-    people.debian.org/~aurel32 | www.aurel32.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]