qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] linux-user: Tolerate CONFIG_LSM_MMAP_MIN_ADDR


From: Richard Henderson
Subject: Re: [PATCH] linux-user: Tolerate CONFIG_LSM_MMAP_MIN_ADDR
Date: Mon, 21 Oct 2024 19:34:22 -0700
User-agent: Mozilla Thunderbird

On 10/21/24 05:17, Ilya Leoshkevich wrote:
Running qemu-i386 on a system running with SELinux in enforcing mode
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.

For maximum compatibility, probing is required. Use pgb_find_fallback()
for this purpose. The downside of this approach is that mmap_min_addr
remains incorrect, but there don't seem to be any practical
consequences from this. If a correct mmap_min_addr will be required in
the future, probing will need to be moved to linux-user main().

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
  linux-user/elfload.c | 4 ++++
  1 file changed, 4 insertions(+)

This is

    https://gitlab.com/qemu-project/qemu/-/issues/2598

which we closed as a system configuration / kernel bug.

I'm open to working around the issue, because I can see it coming up again and 
again.

In pgb_find_fallback, we use a skip value of 4M or 4G, using that skip as the base at which to begin the search. I think it might be better to use this as the initial start point in pgb_find_itree as well, rather than mmap_min_addr.

Since I never had a setup in which this triggered, would you be willing to test 
such a change?


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]