From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: Re: [PATCH 1/4] linux-user: fix mremap unmapping adjacent region
Date: Tue, 21 Oct 2025 14:44:45 -0500 [thread overview]
Message-ID: <68c8d609-37a4-4369-ac5e-1542612371c6@linaro.org> (raw)
In-Reply-To: <20251011200337.30258-2-mlugg@mlugg.co.uk>
On 10/11/25 15:03, Matthew Lugg wrote:
> This typo meant that calls to `mremap` which shrink a mapping by some N
> bytes would, when the virtual address space was pre-reserved (e.g.
> 32-bit guest on 64-bit host), unmap the N bytes following the *original*
> mapping.
>
> Signed-off-by: Matthew Lugg <mlugg@mlugg.co.uk>
> ---
> linux-user/mmap.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/linux-user/mmap.c b/linux-user/mmap.c
> index 847092a28a..ec8392b35b 100644
> --- a/linux-user/mmap.c
> +++ b/linux-user/mmap.c
> @@ -1164,7 +1164,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
> errno = ENOMEM;
> host_addr = MAP_FAILED;
> } else if (reserved_va && old_size > new_size) {
> - mmap_reserve_or_unmap(old_addr + old_size,
> + /* Re-reserve pages we just shrunk out of the mapping */
> + mmap_reserve_or_unmap(old_addr + new_size,
> old_size - new_size);
> }
> }
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
next prev parent reply other threads:[~2025-10-21 19:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-11 20:03 [PATCH 0/4] linux-user: fix several mremap bugs Matthew Lugg
2025-10-11 20:03 ` [PATCH 1/4] linux-user: fix mremap unmapping adjacent region Matthew Lugg
2025-10-20 15:08 ` Peter Maydell
2025-10-21 19:44 ` Richard Henderson [this message]
2025-10-11 20:03 ` [PATCH 2/4] linux-user: fix mremap errors for invalid ranges Matthew Lugg
2025-10-20 15:10 ` Peter Maydell
2025-10-21 19:50 ` Richard Henderson
2025-10-11 20:03 ` [PATCH 3/4] linux-user: fix reserved_va page leak in do_munmap Matthew Lugg
2025-10-20 16:00 ` Peter Maydell
2025-11-17 15:06 ` Matthew Lugg
2025-10-21 19:57 ` Richard Henderson
2025-10-11 20:03 ` [PATCH 4/4] tests: add tcg coverage for fixed mremap bugs Matthew Lugg
2025-10-11 20:15 ` Matthew Lugg
2025-10-20 15:26 ` Peter Maydell
2025-11-17 15:13 ` Matthew Lugg
2025-11-17 15:30 ` Matthew Lugg
2025-11-17 8:40 ` [PATCH 0/4] linux-user: fix several " Michael Tokarev
2025-11-17 11:42 ` Peter Maydell
2025-11-17 11:43 ` Michael Tokarev
2025-11-17 11:46 ` Peter Maydell
2025-11-17 11:51 ` Michael Tokarev
2025-11-17 11:54 ` mlugg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=68c8d609-37a4-4369-ac5e-1542612371c6@linaro.org \
--to=richard.henderson@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).