[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.2.8 09/49] linux-user/flatload: Take mmap_lock in load_flt_bin
From: |
Michael Tokarev |
Subject: |
[Stable-8.2.8 09/49] linux-user/flatload: Take mmap_lock in load_flt_binary() |
Date: |
Sat, 9 Nov 2024 13:14:00 +0300 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
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>
diff --git a/linux-user/flatload.c b/linux-user/flatload.c
index 5b62aa0a2b..6278655574 100644
--- a/linux-user/flatload.c
+++ b/linux-user/flatload.c
@@ -747,7 +747,10 @@ int load_flt_binary(struct linux_binprm *bprm, struct
image_info *info)
stack_len += (bprm->envc + 1) * 4; /* the envp array */
+ mmap_lock();
res = load_flat_file(bprm, libinfo, 0, &stack_len);
+ mmap_unlock();
+
if (is_error(res)) {
return res;
}
--
2.39.5
- [Stable-8.2.8 v1 00/49] Patch Round-up for stable 8.2.8, freeze on 2024-11-18, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 01/49] softmmu/physmem.c: Keep transaction attribute in address_space_map(), Michael Tokarev, 2024/11/09
- [Stable-8.2.8 03/49] tcg: Fix iteration step in 32-bit gvec operation, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 08/49] testing: bump mips64el cross to bookworm and fix package list, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 02/49] target/arm: Correct ID_AA64ISAR1_EL1 value for neoverse-v1, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 07/49] fuzz: disable leak-detection for oss-fuzz builds, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 06/49] target/arm: Avoid target_ulong for physical address lookups, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 09/49] linux-user/flatload: Take mmap_lock in load_flt_binary(),
Michael Tokarev <=
- [Stable-8.2.8 13/49] target/m68k: Always return a temporary from gen_lea_mode, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 04/49] target/ppc: Fix lxvx/stxvx facility check, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 05/49] block/reqlist: allow adding overlapping requests, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 17/49] KVM: Dynamic sized kvm memslots array, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 12/49] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 14/49] hw/intc/arm_gicv3_cpuif: Add cast to match the documentation, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 10/49] linux-user: Fix parse_elf_properties GNU0_MAGIC check, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 19/49] tests: Wait for migration completion on destination QEMU to avoid failures, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 20/49] tests/qemu-iotests/211.out: Update to expect MapEntry 'compressed' field, Michael Tokarev, 2024/11/09
- [Stable-8.2.8 28/49] gitlab: make check-[dco|patch] a little more verbose, Michael Tokarev, 2024/11/09