x86/asm/entry/32, selftests: Add test_syscall_vdso test
PATCH v2 1/1 x86/asm/entry/32, selftests: Add test_syscall_vdso test
The test is fairly simplistic: it checks that all registers are preserved across 32-bit syscall via VDSO.
Run-tested:
$ ./test_syscall_vdso_32 [RUN] Executing 6-argument 32-bit syscall via VDSO [Ok] Arguments are preserved across syscall [RUN] Executing 6-argument 32-bit syscall via INT 80 [Ok] Arguments are preserved across syscall [RUN] Running tests under ptrace [RUN] Executing 6-argument 32-bit syscall via VDSO [Ok] Arguments are preserved across syscall [RUN] Executing 6-argument 32-bit syscall via INT 80 [Ok] Arguments are preserved across syscall
---
Changes in v2:
does not fail if VDSO can't be found;
tests INT 80 syscall method;
tests syscalls under ptrace;
switched to /* */ comments
tools/testing/selftests/x86/Makefile | 2 +- tools/testing/selftests/x86/test_syscall_vdso.c | 271 ++++++++++++++++++++++++ 2 files changed, 272 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/x86/test_syscall_vdso.c
tools/testing/selftests/x86/Makefile +1 -1
@@ -5,7 +5,7 @@ include ../lib.mk .PHONY: all all_32 all_64 warn_32bit_failure clean TARGETS_C_BOTHBITS := sigreturn single_step_syscall sysret_ss_attrs -TARGETS_C_32BIT_ONLY := entry_from_vm86 +TARGETS_C_32BIT_ONLY := entry_from_vm86 test_syscall_vdso TARGETS_C_32BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_32BIT_ONLY) BINARIES_32 := $(TARGETS_C_32BIT_ALL:%=%_32)
tools/testing/selftests/x86/test_syscall_vdso.c new file +271 -0
271 lines not on this page · raw message
Signature · 1 line
1.8.1.4
tools/testing/selftests/x86/test_syscall_vdso.c line 270
Quoted 6 lines · Denys Vlasenko
tools/testing/selftests/x86/test_syscall_vdso.c new file +6
-0+ exitcode +=run_syscall_twice (); +ptrace_me (); + exitcode +=run_syscall_twice (); + +return 0 ; +}
Er... that last line was supposed to be "return exitcode;"
Quoted 5 lines · Denys Vlasenko
The test is fairly simplistic: it checks that all registers are preserved across 32-bit syscall via VDSO.
Run-tested:
Quoted 10 lines
$ ./test_syscall_vdso_32 [RUN] Executing 6-argument 32-bit syscall via VDSO [Ok] Arguments are preserved across syscall [RUN] Executing 6-argument 32-bit syscall via INT 80 [Ok] Arguments are preserved across syscall [RUN] Running tests under ptrace [RUN] Executing 6-argument 32-bit syscall via VDSO [Ok] Arguments are preserved across syscall [RUN] Executing 6-argument 32-bit syscall via INT 80 [Ok] Arguments are preserved across syscall
Just curious: is there a kernel sha1 where this test would fail? Or did you try to provoke an information leak perhaps?
Thanks,
Ingo
Quoted 19 lines · Ingo Molnar
Quoted 5 lines · Denys Vlasenko
The test is fairly simplistic: it checks that all registers are preserved across 32-bit syscall via VDSO.
Run-tested:
Quoted 10 lines
$ ./test_syscall_vdso_32 [RUN] Executing 6-argument 32-bit syscall via VDSO [Ok] Arguments are preserved across syscall [RUN] Executing 6-argument 32-bit syscall via INT 80 [Ok] Arguments are preserved across syscall [RUN] Running tests under ptrace [RUN] Executing 6-argument 32-bit syscall via VDSO [Ok] Arguments are preserved across syscall [RUN] Executing 6-argument 32-bit syscall via INT 80 [Ok] Arguments are preserved across syscall
Quoted 2 lines
Just curious: is there a kernel sha1 where this test would fail? Or did you try to provoke an information leak perhaps?
I did see failures, more than once, when testing my own patches.
I'm not aware of released kernels which are buggy wrt this test.
Quoted 20 lines · Denys Vlasenko
Quoted 19 lines · Ingo Molnar
Quoted 15 lines · Denys Vlasenko
The test is fairly simplistic: it checks that all registers are preserved across 32-bit syscall via VDSO.
Run-tested:
$ ./test_syscall_vdso_32 [RUN] Executing 6-argument 32-bit syscall via VDSO [Ok] Arguments are preserved across syscall [RUN] Executing 6-argument 32-bit syscall via INT 80 [Ok] Arguments are preserved across syscall [RUN] Running tests under ptrace [RUN] Executing 6-argument 32-bit syscall via VDSO [Ok] Arguments are preserved across syscall [RUN] Executing 6-argument 32-bit syscall via INT 80 [Ok] Arguments are preserved across syscall
Quoted 4 lines
Quoted 2 lines
Just curious: is there a kernel sha1 where this test would fail? Or did you try to provoke an information leak perhaps?
I did see failures, more than once, when testing my own patches.
Ok!
Quoted 1 line
I'm not aware of released kernels which are buggy wrt this test.
Great! :-)
Thanks,
Ingo