]> git.ipfire.org Git - thirdparty/qemu.git/commit
elfload: Fix alignment when unmapping excess reservation
authorFabiano Rosas <farosas@suse.de>
Thu, 13 Feb 2025 14:35:58 +0000 (11:35 -0300)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 19 Feb 2025 11:01:02 +0000 (14:01 +0300)
commitdffec2ddd0240758822c013b13ac9364d785735a
tree559ec2f9d8286a2a411407f7223f99687b9f70a5
parentaead95c7fafdac3fe8380c1e9f1be38122eb1b7e
elfload: Fix alignment when unmapping excess reservation

When complying with the alignment requested in the ELF and unmapping
the excess reservation, having align_end not aligned to the guest page
causes the unmap to be rejected by the alignment check at
target_munmap and later brk adjustments hit an EEXIST.

Fix by aligning the start of region to be unmapped.

Fixes: c81d1fafa6 ("linux-user: Honor elf alignment when placing images")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1913
Signed-off-by: Fabiano Rosas <farosas@suse.de>
[rth: Align load_end as well.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250213143558.10504-1-farosas@suse.de>
(cherry picked from commit 4b7b20a3b72c5000ea71bef505c16e6e628268b6)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
linux-user/elfload.c