• Denys Vlasenko's avatar
    x86/asm/entry/32, selftests: Add 'test_syscall_vdso' test · c25be94f
    Denys Vlasenko authored
    This new test checks that all x86 registers are preserved across
    32-bit syscalls. It tests syscalls through VDSO (if available)
    and through INT 0x80, normally and under ptrace.
    
    If kernel is a 64-bit one, high registers (r8..r15) are poisoned
    before the syscall is called and are checked afterwards.
    
    They must be either preserved, or cleared to zero (but r11 is
    special); r12..15 must be preserved for INT 0x80.
    
    EFLAGS is checked for changes too, but change there is not
    considered to be a bug (paravirt kernels do not preserve
    arithmetic flags).
    
    Run-tested on 64-bit kernel:
    
    	$ ./test_syscall_vdso_32
    	[RUN]	Executing 6-argument 32-bit syscall via VDSO
    	[OK]	Arguments are preserved across syscall
    	[NOTE]	R11 has changed:0000000000200ed7 - assuming clobbered by
    	SYSRET insn [OK]	R8..R15 did not leak kernel data
    	[RUN]	Executing 6-argument 32-bit syscall via INT 80
    	[OK]	Arguments are preserved across syscall
    	[OK]	R8..R15 did not leak kernel data
    	[RUN...
    c25be94f
test_syscall_vdso.c 9.35 KB