Skip to contentSkip to conversation

linux-user: hide reserved mmap in /proc/self/mmap

PATCH Michael Roth 1 participant 1 message Aug 6, 2014 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Quoting Mikhail Ilin (2014-07-18 02:39:46)

Quoted 16 lines

Hi,

Running 32-bits binaries with address sanitizer (ASAN) instrumentations fails under 64-bits qemu. During initialization ASAN relies on the output from /proc/self/mmap then tries to find a big chunk for shadow memory but it is not happened.

Reserved memory for guest address space is used privately by qemu to satisfy user anonymous mmap calls but in the same time it is not hidden from an application and is reported when a user reads /proc/self/mmap. Qemu is not fully transparent for a guest.

The patch covers the case and cleans up the reserved memory map from the output.

Quoted 8 lines

From 167c42e6a9521c05ddd7c6dfbb108d2ae65de098 Mon Sep 17 00:00:00 2001
From: Mikhail Ilyin <[email protected]>
Date: Fri, 18 Jul 2014 10:14:06 +0400
Subject: [PATCH] Clean up the reserved memory map from /proc/self/mmap output
which doesn't belong to an emulated process.

Hi Mikhail, all patches need to go through [email protected] (Cc'd). qemu-stable is for fixes potentially applicable to older qemu releases, but qemu-devel should be cc'd in either case.

Quoted 24 lines
---
  linux-user/syscall.c | 7 +++++++
  1 file changed, 7 insertions(+)
linux-user/syscall.c +7 -0
index a50229d..8f406e4 100644
@@ -5122,6 +5122,13 @@ static int open_self_maps(void *cpu_env, int fd)
              continue;
          }
          if (h2g_valid(min) && h2g_valid(max)) {
+#ifdef CONFIG_USE_GUEST_BASE
+            if (RESERVED_VA) {
+                if (mmap_next_start == h2g(max)) {
+                    continue;
+                }
+            }
+#endif
              dprintf(fd, TARGET_ABI_FMT_lx "-" TARGET_ABI_FMT_lx
                      " %c%c%c%c %08" PRIx64 " %02x:%02x %d %s%s\n",
                      h2g(min), h2g(max), flag_r, flag_w,
Signature · 1 line
1.9.1