[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 4/5] linux-user: Add x86_64 vsyscall page to /proc/self/ma
From: |
Alex Bennée |
Subject: |
Re: [PATCH v2 4/5] linux-user: Add x86_64 vsyscall page to /proc/self/maps |
Date: |
Mon, 20 Jan 2020 14:41:39 +0000 |
User-agent: |
mu4e 1.3.6; emacs 28.0.50 |
Richard Henderson <address@hidden> writes:
> 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 <address@hidden>
> ---
> linux-user/syscall.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 171c0caef3..eb867a5296 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -7005,6 +7005,15 @@ static int open_self_maps(void *cpu_env, int fd)
> }
> }
>
> +#ifdef TARGET_X86_64
> + /*
> + * We only support execution from the vsyscall page.
> + * This is as if CONFIG_LEGACY_VSYSCALL_XONLY=y from v5.3.
> + */
> + dprintf(fd, "ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0"
> + " [vsyscall]\n");
> +#endif
> +
I'm not sure what whitespace is wrong - tabs maybe? But looking at a
real vsyscall system vs emulated things line up better:
Welcome to Buildroot
buildroot login: root
# uname -a
Linux buildroot 5.4.13 #1 SMP Mon Jan 20 14:36:20 GMT 2020 x86_64 GNU/Linux
# cat /proc/self/maps
00400000-004ab000 r-xp 00000000 00:02 7635
/bin/busybox
004ab000-004ac000 r-xp 000aa000 00:02 7635
/bin/busybox
004ac000-004ad000 rwxp 000ab000 00:02 7635
/bin/busybox
004ad000-004ae000 rwxp 00000000 00:00 0
7fcc91566000-7fcc91567000 rwxp 00000000 00:00 0
7fcc91567000-7fcc915de000 r-xp 00000000 00:02 7475
/lib/libuClibc-1.0.32.so
7fcc915de000-7fcc915df000 ---p 00000000 00:00 0
7fcc915df000-7fcc915e0000 r-xp 00077000 00:02 7475
/lib/libuClibc-1.0.32.so
7fcc915e0000-7fcc915e1000 rwxp 00078000 00:02 7475
/lib/libuClibc-1.0.32.so
7fcc915e1000-7fcc915fc000 rwxp 00000000 00:00 0
7fcc915fc000-7fcc91603000 r-xp 00000000 00:02 7480
/lib/ld64-uClibc-1.0.32.so
7fcc91603000-7fcc91604000 r-xp 00006000 00:02 7480
/lib/ld64-uClibc-1.0.32.so
7fcc91604000-7fcc91605000 rwxp 00007000 00:02 7480
/lib/ld64-uClibc-1.0.32.so
7ffd92001000-7ffd92022000 rwxp 00000000 00:00 0
[stack]
7ffd920c3000-7ffd920c6000 r--p 00000000 00:00 0
[vvar]
7ffd920c6000-7ffd920c7000 r-xp 00000000 00:00 0
[vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]
# QEMU 4.2.50 monitor - type 'help' for more information
(qemu) quit
14:38:52 [alex.bennee@hackbox2:~/l/q/b/all] review/fix-user-brk|… +
./x86_64-linux-user/qemu-x86_64 /bin/cat /proc/self/maps
4000000000-4000008000 r-xp 00000000 00:19 8131 /bin/cat
4000008000-4000207000 ---p 00000000 00:00 0
4000207000-4000208000 r--p 00007000 00:19 8131 /bin/cat
4000208000-4000209000 rw-p 00008000 00:19 8131 /bin/cat
4000209000-400022a000 rw-p 00000000 00:00 0
4001209000-400120a000 ---p 00000000 00:00 0
400120a000-4001a0a000 rw-p 00000000 00:00 0 [stack]
4001a0a000-4001a31000 r-xp 00000000 00:19 3644
/lib/x86_64-linux-gnu/ld-2.27.so
4001a31000-4001c31000 ---p 00000000 00:00 0
4001c31000-4001c32000 r--p 00027000 00:19 3644
/lib/x86_64-linux-gnu/ld-2.27.so
4001c32000-4001c33000 rw-p 00028000 00:19 3644
/lib/x86_64-linux-gnu/ld-2.27.so
4001c33000-4001c36000 rw-p 00000000 00:00 0
4001c6d000-4001e54000 r-xp 00000000 00:19 3648
/lib/x86_64-linux-gnu/libc-2.27.so
4001e54000-4002054000 ---p 001e7000 00:19 3648
/lib/x86_64-linux-gnu/libc-2.27.so
4002054000-4002058000 r--p 001e7000 00:19 3648
/lib/x86_64-linux-gnu/libc-2.27.so
4002058000-400205a000 rw-p 001eb000 00:19 3648
/lib/x86_64-linux-gnu/libc-2.27.so
400205a000-4002060000 rw-p 00000000 00:00 0
4002060000-40023d2000 r--p 00000000 00:19 195276
/usr/lib/locale/locale-archive
ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall]
> free(line);
> fclose(fp);
--
Alex Bennée
- [PATCH v2 2/5] linux-user/i386: Split out gen_signal, (continued)
- [PATCH v2 2/5] linux-user/i386: Split out gen_signal, Richard Henderson, 2020/01/16
- [PATCH v2 3/5] linux-user/i386: Emulate x86_64 vsyscalls, Richard Henderson, 2020/01/16
- Re: [PATCH v2 3/5] linux-user/i386: Emulate x86_64 vsyscalls, Alex Bennée, 2020/01/20
- Re: [PATCH v2 3/5] linux-user/i386: Emulate x86_64 vsyscalls, Richard Henderson, 2020/01/20
- Re: [PATCH v2 3/5] linux-user/i386: Emulate x86_64 vsyscalls, Alex Bennée, 2020/01/21
- Re: [PATCH v2 3/5] linux-user/i386: Emulate x86_64 vsyscalls, Richard Henderson, 2020/01/21
- Re: [PATCH v2 3/5] linux-user/i386: Emulate x86_64 vsyscalls, Alex Bennée, 2020/01/21
- Re: [PATCH v2 3/5] linux-user/i386: Emulate x86_64 vsyscalls, Paolo Bonzini, 2020/01/21
[PATCH v2 4/5] linux-user: Add x86_64 vsyscall page to /proc/self/maps, Richard Henderson, 2020/01/16
[PATCH v2 5/5] linux-user: Flush out implementation of gettimeofday, Richard Henderson, 2020/01/16
Re: [PATCH v2 0/5] linux-user: Implement x86_64 vsyscalls, Richard Henderson, 2020/01/16
Re: [PATCH v2 0/5] linux-user: Implement x86_64 vsyscalls, Laurent Vivier, 2020/01/28