linux-user: Add x86_64 vsyscall page to /proc/self/maps
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 13 Feb 2020 03:22:22 +0000 (19:22 -0800)
committerLaurent Vivier <laurent@vivier.eu>
Thu, 26 Mar 2020 07:08:54 +0000 (08:08 +0100)
The page isn't (necessarily) present in the host /proc/self/maps,
and even if it might be it isn't present in page_flags, and even
if it was it might not have the same set of page permissions.

The easiest thing to do, particularly when it comes to the
"[vsyscall]" note at the end of line, is to special case it.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200213032223.14643-5-richard.henderson@linaro.org>
[lv: remove trailing space]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/syscall.c

index 35f4146662432efa488b6dc67652eff4c2170904..dbdd56e420777146e56310698c9a59b988da0b7b 100644 (file)
@@ -7144,6 +7144,16 @@ static int open_self_maps(void *cpu_env, int fd)
         }
     }
 
+#ifdef TARGET_VSYSCALL_PAGE
+    /*
+     * We only support execution from the vsyscall page.
+     * This is as if CONFIG_LEGACY_VSYSCALL_XONLY=y from v5.3.
+     */
+    dprintf(fd, TARGET_FMT_lx "-" TARGET_FMT_lx
+            " --xp 00000000 00:00 0 [vsyscall]\n",
+            TARGET_VSYSCALL_PAGE, TARGET_VSYSCALL_PAGE + TARGET_PAGE_SIZE);
+#endif
+
     free(line);
     fclose(fp);