Re: [PATCHv9 2/2] selftest/x86: add mremap vdso test

From: Dmitry Safonov
Date: Fri Jun 17 2016 - 05:26:24 EST


On 06/17/2016 11:03 AM, Ingo Molnar wrote:

* Dmitry Safonov <dsafonov@xxxxxxxxxxxxx> wrote:

Should print on success:
[root@localhost ~]# ./test_mremap_vdso_32
AT_SYSINFO_EHDR is 0xf773f000
[NOTE] Moving vDSO: [f773f000, f7740000] -> [a000000, a001000]
[OK]
Or segfault if landing was bad (before patches):
[root@localhost ~]# ./test_mremap_vdso_32
AT_SYSINFO_EHDR is 0xf774f000
[NOTE] Moving vDSO: [f774f000, f7750000] -> [a000000, a001000]
Segmentation fault (core dumped)

Yeah, so I changed my mind again, I still don't like that the testcase faults on
old kernels:

triton:~/tip/tools/testing/selftests/x86> ./test_mremap_vdso_32
AT_SYSINFO_EHDR is 0xf7786000
[NOTE] Moving vDSO: [0xf7786000, 0xf7787000] -> [0xf7781000, 0xf7782000]
Segmentation fault

How do I know that this testcase is special and that a segmentation fault in this
case means that I'm running it on a too old kernel and that it's not some other
unexpected failure in the test?

At minimum please run it behind fork() and catch the -SIGSEGV child exit:

mremap(0xf7747000, 4096, 4096, MREMAP_MAYMOVE|MREMAP_FIXED, 0xf7742000) = 0xf7742000
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xf7747be9} ---
+++ killed by SIGSEGV +++

and print:

[FAIL] mremap() of the vDSO does not work on this kernel!

or such.

Ok?

Ok, will do.

Thanks,
Dmitry