[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 21/33] linux-user: Split out mmap_h_eq_g
|
From: |
Ilya Leoshkevich |
|
Subject: |
Re: [PATCH v3 21/33] linux-user: Split out mmap_h_eq_g |
|
Date: |
Mon, 29 Jan 2024 16:12:27 +0100 |
On Tue, Jan 02, 2024 at 12:57:56PM +1100, Richard Henderson wrote:
> Move the MAX_FIXED_NOREPLACE check for reserved_va earlier.
> Move the computation of host_prot earlier.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> linux-user/mmap.c | 66 +++++++++++++++++++++++++++++++++++++----------
> 1 file changed, 53 insertions(+), 13 deletions(-)
>
> diff --git a/linux-user/mmap.c b/linux-user/mmap.c
> index 42eb3eb2b4..00003b8329 100644
> --- a/linux-user/mmap.c
> +++ b/linux-user/mmap.c
> @@ -527,6 +527,31 @@ static abi_long mmap_end(abi_ulong start, abi_ulong last,
> return start;
> }
>
> +/*
> + * Special case host page size == target page size,
> + * where there are no edge conditions.
> + */
> +static abi_long mmap_h_eq_g(abi_ulong start, abi_ulong len,
> + int host_prot, int flags, int page_flags,
> + int fd, off_t offset)
> +{
> + void *p, *want_p = g2h_untagged(start);
> + abi_ulong last;
> +
> + p = mmap(want_p, len, host_prot, flags, fd, offset);
> + if (p == MAP_FAILED) {
> + return -1;
> + }
> + if ((flags & MAP_FIXED_NOREPLACE) && p != want_p) {
Should we munmap() here?
I've seen this situation in some of the previous patches as well, but
there we were about to exit, and here the program may continue
running.
[...]
- Re: [PATCH v3 16/33] linux-user: Split out target_mmap__locked, (continued)
- [PATCH v3 17/33] linux-user: Move some mmap checks outside the lock, Richard Henderson, 2024/01/01
- [PATCH v3 18/33] linux-user: Fix sub-host-page mmap, Richard Henderson, 2024/01/01
- [PATCH v3 19/33] linux-user: Split out mmap_end, Richard Henderson, 2024/01/01
- [PATCH v3 21/33] linux-user: Split out mmap_h_eq_g, Richard Henderson, 2024/01/01
- [PATCH v3 24/33] tests/tcg: Remove run-test-mmap-*, Richard Henderson, 2024/01/01
- [PATCH v3 20/33] linux-user: Do early mmap placement only for reserved_va, Richard Henderson, 2024/01/01
- [PATCH v3 22/33] linux-user: Split out mmap_h_lt_g, Richard Henderson, 2024/01/01
- [PATCH v3 23/33] linux-user: Split out mmap_h_gt_g, Richard Henderson, 2024/01/01