Re: [PATCH v3 23/23] x86/vdso/selftest: Add a test for unmapping vDSO

From: Shuah Khan
Date: Fri Jun 11 2021 - 14:22:01 EST


On 6/11/21 12:02 PM, Dmitry Safonov wrote:
Output for landing on x86:
[root@localhost ~]# ./test_munmap_vdso_64
AT_SYSINFO_EHDR is 0x7fffead9f000
[NOTE] unmapping vDSO: [0x7fffead9f000, 0x7fffeada0000]
[NOTE] vDSO partial move failed, will try with bigger size
[NOTE] unmapping vDSO: [0x7fffead9f000, 0x7fffeada1000]
[OK]
[root@localhost ~]# ./test_munmap_vdso_32
AT_SYSINFO_EHDR is 0xf7eef000
[NOTE] unmapping vDSO: [0xf7eef000, 0xf7ef0000]
[NOTE] vDSO partial move failed, will try with bigger size
[NOTE] unmapping vDSO: [0xf7eef000, 0xf7ef1000]
[OK]

The test also can check force_sigsegv(SIGSEGV) in do_fast_syscall_32():
[root@localhost ~]# ./test_munmap_vdso_32 sysenter
[NOTE] Using sysenter after munmap
AT_SYSINFO_EHDR is 0xf7efe000
[NOTE] unmapping vDSO: [0xf7efe000, 0xf7eff000]
[NOTE] vDSO partial move failed, will try with bigger size
[NOTE] unmapping vDSO: [0xf7efe000, 0xf7f00000]
[OK] 32-bit process gets segfault on fast syscall with unmapped vDSO

Cc: Shuah Khan <shuah@xxxxxxxxxx>
Signed-off-by: Dmitry Safonov <dima@xxxxxxxxxx>
---
tools/testing/selftests/x86/.gitignore | 1 +
tools/testing/selftests/x86/Makefile | 11 +-
.../testing/selftests/x86/test_munmap_vdso.c | 151 ++++++++++++++++++
3 files changed, 158 insertions(+), 5 deletions(-)
create mode 100644 tools/testing/selftests/x86/test_munmap_vdso.c


I can take this through kselftest tree for 5.14 - are there any
dependencies on x86 tree, I should be aware of?

thanks,
-- Shuah