Skip to contentSkip to conversation

selftests/x86: Test __kernel_sigreturn and __kernel_rt_sigreturn

PATCH New Andy Lutomirski 2 participants 2 messages Jan 12, 2016 – Jan 13, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 selftests/x86: Test __kernel_sigreturn and __kernel_rt_sigreturn

The vdso-based sigreturn mechanism is fragile and isn't used by modern glibc so, if we break it, we'll only notice when someone tests an unusual libc.

Add an explicit selftest.

---

I wrote this while debugging the Bionic breakage -- my first guess was that I had somehow messed up sigreturn. I've caused problems in that code before, and it's really easy to fail to notice it because there's nothing on a modern distro that needs vdso-based sigreturn.

Changes from v1: Add missing handler_called = 0 (rdd)

tools/testing/selftests/x86/Makefile | 3 +-

 tools/testing/selftests/x86/vdso_restorer.c | 88 +++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/x86/vdso_restorer.c
tools/testing/selftests/x86/Makefile +2 -1
index 398bb0e6e38c..d0c473f65850 100644
@@ -7,7 +7,8 @@ include ../lib.mk
 TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt ptrace_syscall
 TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault sigreturn test_syscall_vdso unwind_vdso \
 			test_FCMOV test_FCOMI test_FISTTP \
-			ldt_gdt
+			ldt_gdt \
+			vdso_restorer
 
 TARGETS_C_32BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_32BIT_ONLY)
 BINARIES_32 := $(TARGETS_C_32BIT_ALL:%=%_32)
tools/testing/selftests/x86/vdso_restorer.c new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
2.5.0
#1 lore raw
selftests/x86: Test __kernel_sigreturn and __kernel_rt_sigreturn
Commit-ID:  65cacec1ba908a153cfb19c4de596a108f95970c
Gitweb:     http://git.kernel.org/tip/65cacec1ba908a153cfb19c4de596a108f95970c
Author:     Andy Lutomirski <[email protected]>
AuthorDate: Tue, 12 Jan 2016 11:56:15 -0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 13 Jan 2016 10:34:40 +0100

selftests/x86: Test __kernel_sigreturn and __kernel_rt_sigreturn

The vdso-based sigreturn mechanism is fragile and isn't used by modern glibc so, if we break it, we'll only notice when someone tests an unusual libc.

Add an explicit selftest.

[ I wrote this while debugging a Bionic breakage -- my first guess
was that I had somehow messed up sigreturn. I've caused problems in that code before, and it's really easy to fail to notice it because there's nothing on a modern distro that needs vdso-based sigreturn. ]

---
 tools/testing/selftests/x86/Makefile        |  3 +-
 tools/testing/selftests/x86/vdso_restorer.c | 88 +++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 1 deletion(-)
tools/testing/selftests/x86/Makefile +2 -1
index 398bb0e..d0c473f 100644
@@ -7,7 +7,8 @@ include ../lib.mk
 TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt ptrace_syscall
 TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault sigreturn test_syscall_vdso unwind_vdso \
 			test_FCMOV test_FCOMI test_FISTTP \
-			ldt_gdt
+			ldt_gdt \
+			vdso_restorer
 
 TARGETS_C_32BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_32BIT_ONLY)
 BINARIES_32 := $(TARGETS_C_32BIT_ALL:%=%_32)
tools/testing/selftests/x86/vdso_restorer.c new file +88 -0

88 lines not on this page · raw message