]> git.ipfire.org Git - thirdparty/qemu.git/commit
linux-user: Avoid mmap of the last byte of the reserved_va
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 29 Jun 2023 08:08:35 +0000 (10:08 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Sat, 1 Jul 2023 10:57:27 +0000 (13:57 +0300)
commitdf1e45c9dfc8d5e9f8c19677799e8a77c601ce29
tree73381dc543dab911b51c84e06c3c9ac20fbd51ca
parent383fb8c05c4a5db4b7afda11c1752a80b1e74be1
linux-user: Avoid mmap of the last byte of the reserved_va

There is an overflow problem in mmap_find_vma_reserved:
when reserved_va == UINT32_MAX, end may overflow to 0.
Rather than a larger rewrite at this time, simply avoid
the final byte of the VA, which avoids searching the
final page, which avoids the overflow.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1741
Fixes: 95059f9c ("include/exec: Change reserved_va semantics to last byte")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Message-Id: <20230629080835.71371-1-richard.henderson@linaro.org>
(cherry picked from commit 605a8b5491a119a2a6efbf61e5a38f9374645990)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
linux-user/mmap.c