Re: [RFC] selftests/x86: Add test_vsyscall

From: Borislav Petkov
Date: Fri Jan 05 2018 - 08:40:33 EST


On Thu, Jan 04, 2018 at 09:38:37PM -0800, Andy Lutomirski wrote:
> It's RFC because I want to re-read it myself first. It's also missing
> a test that will reliably make sure that vsyscall=none prevents use of
> vsyscalls.

With my patch ontop of 4.4 from yesterday:

# ./test_vsyscall_32
Warning: failed to find getcpu in vDSO
[RUN] test gettimeofday()
vDSO time offsets: 0.000001 0.000001
[OK] vDSO gettimeofday()'s timeval was okay
[RUN] test time()
[OK] vDSO time() is okay
[RUN] getcpu() on CPU 0
[RUN] getcpu() on CPU 1
# ./test_vsyscall_64
vsyscall map: ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
vsyscall permissions are r-x
[RUN] test gettimeofday()
vDSO time offsets: 0.000000 0.000005
[OK] vDSO gettimeofday()'s timeval was okay
vsyscall time offsets: 0.000004 0.000001
[OK] vsyscall gettimeofday()'s timeval was okay
[RUN] test time()
[OK] vDSO time() is okay
[OK] vsyscall time() is okay
[RUN] getcpu() on CPU 0
[OK] vDSO reported correct CPU
[OK] vDSO reported correct node
[OK] vsyscall reported correct CPU
[OK] vsyscall reported correct node
[RUN] getcpu() on CPU 1
[OK] vDSO reported correct CPU
[OK] vDSO reported correct node
[OK] vsyscall reported correct CPU
[OK] vsyscall reported correct node
[RUN] Checking read access to the vsyscall page
[FAIL] We don't have read access, but we should

Do I really need the read access? :-)

I have CONFIG_LEGACY_VSYSCALL_EMULATE=y

Thx.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.