]> git.ipfire.org Git - thirdparty/qemu.git/commit
linux-user/flatload: Take mmap_lock in load_flt_binary()
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 22 Aug 2024 09:50:43 +0000 (11:50 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 10 Oct 2024 18:04:46 +0000 (21:04 +0300)
commit49d42ed3bd39dd495b5e4b2e976b4723d2d9e62f
tree465d854bd47a08f4e5af0102ed544678db4b0da4
parent3d08ffe0baff393ad04438684479707c721b5361
linux-user/flatload: Take mmap_lock in load_flt_binary()

load_flt_binary() calls load_flat_file() -> page_set_flags().

page_set_flags() must be called with the mmap_lock held,
otherwise it aborts:

  $ qemu-arm -L stm32/lib/ stm32/bin/busybox
  qemu-arm: ../accel/tcg/user-exec.c:505: page_set_flags: Assertion `have_mmap_lock()' failed.
  Aborted (core dumped)

Fix by taking the lock in load_flt_binary().

Fixes: fbd3c4cff6 ("linux-user/arm: Mark the commpage executable")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2525
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240822095045.72643-3-philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit a9ee641bd46f5462eeed183ac3c3760bddfc2600)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
linux-user/flatload.c