From: Helge Deller <deller@kernel.org>
To: qemu-devel@nongnu.org
Cc: Helge Deller <deller@gmx.de>, Peter Maydell <peter.maydell@linaro.org>
Subject: [PATCH 2/2] linux-user: Fix loading static ARM cortex-m55 binaries
Date: Tue, 26 May 2026 16:50:49 +0200 [thread overview]
Message-ID: <20260526145049.7239-2-deller@kernel.org> (raw)
In-Reply-To: <20260526145049.7239-1-deller@kernel.org>
From: Helge Deller <deller@gmx.de>
Static built ARM binaries for Cortex-m55 may have been linked to have
their load address at address 0 (because they are effectively a
bare-metal image). When qemu-user is running as non-root user and will
try to mmap() a host address at 0 (which is smaller than mmap_min_addr
according to /proc/sys/vm/mmap_min_addr), it will fail with EPERM and as
such loading those guest program will fail.
Fix pgb_addr_set() to always return false if the guest_loaddr <
mmap_min_addr, that way a valdid guest_base address will be calculated
and the EPERM can be avoided.
Signed-off-by: Helge Deller <deller@gmx.de>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/1890
---
linux-user/elfload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 0e757787d2..77e0526996 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -866,7 +866,7 @@ static bool pgb_addr_set(PGBAddrs *ga, abi_ulong guest_loaddr,
if (LO_COMMPAGE != -1 && LO_COMMPAGE < mmap_min_addr) {
return false;
}
- if (guest_loaddr != 0 && guest_loaddr < mmap_min_addr) {
+ if (guest_loaddr < mmap_min_addr) {
return false;
}
}
--
2.54.0
next prev parent reply other threads:[~2026-05-26 14:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 14:50 [PATCH 1/2] linux-user: Implement finer grained madivse() syscall Helge Deller
2026-05-26 14:50 ` Helge Deller [this message]
2026-05-27 15:47 ` [PATCH 2/2] linux-user: Fix loading static ARM cortex-m55 binaries Richard Henderson
2026-05-27 15:47 ` [PATCH 1/2] linux-user: Implement finer grained madivse() syscall Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260526145049.7239-2-deller@kernel.org \
--to=deller@kernel.org \
--cc=deller@gmx.de \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.