[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-9.0.4 63/71] linux-user: Tolerate CONFIG_LSM_MMAP_MIN_ADDR
From: |
Michael Tokarev |
Subject: |
[Stable-9.0.4 63/71] linux-user: Tolerate CONFIG_LSM_MMAP_MIN_ADDR |
Date: |
Tue, 19 Nov 2024 00:08:20 +0300 |
From: Ilya Leoshkevich <iii@linux.ibm.com>
Running qemu-i386 on a system running with SELinux in enforcing mode
(more precisely: s390x trixie container on Fedora 40) fails with:
qemu-i386: tests/tcg/i386-linux-user/sigreturn-sigmask: Unable to find a
guest_base to satisfy all guest address mapping requirements
00000000-ffffffff
The reason is that main() determines mmap_min_addr from
/proc/sys/vm/mmap_min_addr, but SELinux additionally defines
CONFIG_LSM_MMAP_MIN_ADDR, which is normally larger: 32K or 64K, but,
in general, can be anything. There is no portable way to query its
value: /boot/config, /proc/config and /proc/config.gz are distro- and
environment-specific.
Once the identity map fails, the magnitude of guest_base does not
matter, so fix by starting the search from 1M or 1G.
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2598
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-ID: <20241023002558.34589-1-iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit fb7f3572b111ffb6c2dd2c7f6c5b4dc57dd8a3f5)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index a343fb5ad0..42185cc111 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2986,7 +2986,7 @@ static uintptr_t pgb_try_itree(const PGBAddrs *ga,
uintptr_t base,
static uintptr_t pgb_find_itree(const PGBAddrs *ga, IntervalTreeRoot *root,
uintptr_t align, uintptr_t brk)
{
- uintptr_t last = mmap_min_addr;
+ uintptr_t last = sizeof(uintptr_t) == 4 ? MiB : GiB;
uintptr_t base, skip;
while (true) {
--
2.39.5
- [Stable-9.0.4 v2 00/71] Patch Round-up for stable 9.0.4, freeze on 2024-11-18, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 58/71] target/i386: Fix legacy page table walk, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 59/71] hw/i386/pc: Don't try to init PCI NICs if there is no PCI bus, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 60/71] linux-user: Fix setreuid and setregid to use direct syscalls, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 61/71] target/arm: Drop user-only special case in sve_stN_r, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 64/71] linux-user/arm: Reduce vdso alignment to 4k, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 63/71] linux-user: Tolerate CONFIG_LSM_MMAP_MIN_ADDR,
Michael Tokarev <=
- [Stable-9.0.4 66/71] tcg: Allow top bit of SIMD_DATA_BITS to be set in simd_desc(), Michael Tokarev, 2024/11/18
- [Stable-9.0.4 65/71] linux-user/arm: Select vdso for be8 and be32 modes, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 67/71] target/i386: fix hang when using slow path for ptw_setl, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 62/71] accel/tcg: Fix user-only probe_access_internal plugin check, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 71/71] usb-hub: Fix handling port power control messages, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 70/71] hw/audio/hda: fix memory leak on audio setup, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 69/71] hw/misc/mos6522: Fix bad class definition of the MOS6522 device, Michael Tokarev, 2024/11/18
- [Stable-9.0.4 68/71] contrib/plugins: add compat for g_memdup2, Michael Tokarev, 2024/11/18