diff options
author | Peter Maydell | 2018-07-31 14:52:03 +0200 |
---|---|---|
committer | Peter Maydell | 2018-07-31 14:52:03 +0200 |
commit | 42e76456cf68dc828b8dbd3c7e255197e9b5e57d (patch) | |
tree | 284bac556db55c9ffacbfcad371ece90cafaa856 /linux-user/mmap.c | |
parent | Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (diff) | |
parent | linux-user: ppc64: don't use volatile register during safe_syscall (diff) | |
download | qemu-42e76456cf68dc828b8dbd3c7e255197e9b5e57d.tar.gz qemu-42e76456cf68dc828b8dbd3c7e255197e9b5e57d.tar.xz qemu-42e76456cf68dc828b8dbd3c7e255197e9b5e57d.zip |
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.0-pull-request' into staging
Fix safe_syscall() on ppc64 host
Fix mmap() 0 length error case
# gpg: Signature made Tue 31 Jul 2018 09:41:07 BST
# gpg: using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>"
# gpg: aka "Laurent Vivier <laurent@vivier.eu>"
# gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C
* remotes/vivier2/tags/linux-user-for-3.0-pull-request:
linux-user: ppc64: don't use volatile register during safe_syscall
tests: add check_invalid_maps to test-mmap
linux-user/mmap.c: handle invalid len maps correctly
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user/mmap.c')
-rw-r--r-- | linux-user/mmap.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/linux-user/mmap.c b/linux-user/mmap.c index d0c50e4888..41e0983ce8 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -391,14 +391,23 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, } #endif - if (offset & ~TARGET_PAGE_MASK) { + if (!len) { errno = EINVAL; goto fail; } + /* Also check for overflows... */ len = TARGET_PAGE_ALIGN(len); - if (len == 0) - goto the_end; + if (!len) { + errno = ENOMEM; + goto fail; + } + + if (offset & ~TARGET_PAGE_MASK) { + errno = EINVAL; + goto fail; + } + real_start = start & qemu_host_page_mask; host_offset = offset & qemu_host_page_mask; |