qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 3/4] linux-user: Fix mmap2() syscall on 32-bit targets to all


From: Richard Henderson
Subject: Re: [PATCH 3/4] linux-user: Fix mmap2() syscall on 32-bit targets to allow file mapping beyond 4GB
Date: Fri, 7 Jul 2023 20:47:57 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 7/7/23 14:19, Helge Deller wrote:
The mmap2() syscall allows 32-bit guests to specify the offset into a
file in page units (instead of bytes, as done by mmap(2)).
On physical machines this allows 32-bit applications to map such parts
of large files which are stored beyond the 4GB limit.

Allow the same behaviour when emulating 32-bit guests with qemu.

For that switch the mmap2() function to always take an abi_ullong
(64-bit) offset parameter for target_mmap() and mmap_frag() to avoid an
arithmetical overflow when shifing a 32-bit offset parameter by
12 bits (=PAGE_SHIFT) and thus possibly overflow the abi_ulong (32-bit)
type.

Signed-off-by: Helge Deller<deller@gmx.de>
---
  linux-user/mmap.c      | 9 +++++----
  linux-user/syscall.c   | 2 +-
  linux-user/user-mmap.h | 2 +-
  3 files changed, 7 insertions(+), 6 deletions(-)

https://patchew.org/QEMU/20230630132159.376995-1-richard.henderson@linaro.org/20230630132159.376995-12-richard.henderson@linaro.org/

Wherein I use the host off_t (which must be 64-bits).
(I'm pretty sure there's an older similar patch, but I couldn't find it.)


r~



reply via email to

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