Skip to contentSkip to conversation

linux-user: Clarify error on failure to map guest address space

PATCH In review Andrew Jeffery 2 participants 4 messages Mar 27, 2023 – Jun 9, 2023

lore
Share & tools
lore
#0 lore raw

cover linux-user: Clarify error on failure to map guest address space

Hello,

This series is a couple of trivial improvements to the error message from linux-user's ELF loader when it fails to mmap() the guest's address space. Both issues caused me brief confusion when trying to sort myself out after hitting https://gitlab.com/qemu-project/qemu/-/issues/447

I've build tested the two as a sanity check.

Cheers,

Andrew

Andrew Jeffery (2):
linux-user: elfload: s/min_mmap_addr/mmap_min_addr/
linux-user: elfload: Specify -R is an option for qemu-user binaries

 linux-user/elfload.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/2 linux-user: elfload: s/min_mmap_addr/mmap_min_addr/

As-is the error message can cause some confusion as the mentioned sysctl attribute name is wrong:

https://www.kernel.org/doc/html/latest/admin-guide/sysctl/vm.html#mmap-min-addr

---
 linux-user/elfload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/elfload.c +1 -1
index 1dbc1f0f9baa..601b156b476b 100644
@@ -2771,7 +2771,7 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
     if (addr == MAP_FAILED || addr != test) {
         error_report("Unable to reserve 0x%lx bytes of virtual address "
                      "space at %p (%s) for use as guest address space (check your "
-                     "virtual memory ulimit setting, min_mmap_addr or reserve less "
+                     "virtual memory ulimit setting, mmap_min_addr or reserve less "
                      "using -R option)", reserved_va, test, strerror(errno));
         exit(EXIT_FAILURE);
     }
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/2 linux-user: elfload: Specify -R is an option for qemu-user binaries

In reply to Andrew Jeffery

Given several different concepts are suggested for investigation, let's not confuse e.g. ulimit's -R with what was actually intended.

---
 linux-user/elfload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/elfload.c +2 -1
index 601b156b476b..694794f97202 100644
@@ -2772,7 +2772,8 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
         error_report("Unable to reserve 0x%lx bytes of virtual address "
                      "space at %p (%s) for use as guest address space (check your "
                      "virtual memory ulimit setting, mmap_min_addr or reserve less "
-                     "using -R option)", reserved_va, test, strerror(errno));
+                     "using qemu-user's -R option)",
+                     reserved_va, test, strerror(errno));
         exit(EXIT_FAILURE);
     }
 
Signature · 1 line
2.39.2
#3 lore raw
In reply to Andrew Jeffery
Quoted 7 lines · Andrew Jeffery

Hello,

This series is a couple of trivial improvements to the error message from linux-user's ELF loader when it fails to mmap() the guest's address space. Both issues caused me brief confusion when trying to sort myself out after hitting https://gitlab.com/qemu-project/qemu/-/issues/447

I've build tested the two as a sanity check.

Ping? That seems like some nice rewording, but not my area..

Thanks!

/mjt