Skip to contentSkip to conversation

selftests/x86/ptrace_syscall_32: Fix no-vDSO segfault

PATCH Applied Andy Lutomirski 2 participants 2 messages Mar 12, 2020 – Mar 20, 2020

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

PATCH 1/1 selftests/x86/ptrace_syscall_32: Fix no-vDSO segfault

If AT_SYSINFO is not present, don't try to call a NULL pointer.

---
 tools/testing/selftests/x86/ptrace_syscall.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/testing/selftests/x86/ptrace_syscall.c +6 -2
index 6f22238f3217..12aaa063196e 100644
@@ -414,8 +414,12 @@ int main()
 
 #if defined(__i386__) && (!defined(__GLIBC__) || __GLIBC__ > 2 || __GLIBC_MINOR__ >= 16)
 	vsyscall32 = (void *)getauxval(AT_SYSINFO);
-	printf("[RUN]\tCheck AT_SYSINFO return regs\n");
-	test_sys32_regs(do_full_vsyscall32);
+	if (vsyscall32) {
+		printf("[RUN]\tCheck AT_SYSINFO return regs\n");
+		test_sys32_regs(do_full_vsyscall32);
+	} else {
+		printf("[SKIP]\tAT_SYSINFO is not available\n");
+	}
 #endif
 
 	test_ptrace_syscall_restart();
Signature · 1 line
2.24.1
#1 lore raw
The following commit has been merged into the x86/misc branch of tip:

The following commit has been merged into the x86/misc branch of tip:

Commit-ID:     630b99ab60aa972052a4202a1ff96c7e45eb0054
Gitweb:        https://git.kernel.org/tip/630b99ab60aa972052a4202a1ff96c7e45eb0054
Author:        Andy Lutomirski <[email protected]>
AuthorDate:    Thu, 12 Mar 2020 15:35:51 -07:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Fri, 20 Mar 2020 11:28:47 +01:00

selftests/x86/ptrace_syscall_32: Fix no-vDSO segfault

If AT_SYSINFO is not present, don't try to call a NULL pointer.

---
 tools/testing/selftests/x86/ptrace_syscall.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/testing/selftests/x86/ptrace_syscall.c +6 -2
index 6f22238..12aaa06 100644
@@ -414,8 +414,12 @@ int main()
 
 #if defined(__i386__) && (!defined(__GLIBC__) || __GLIBC__ > 2 || __GLIBC_MINOR__ >= 16)
 	vsyscall32 = (void *)getauxval(AT_SYSINFO);
-	printf("[RUN]\tCheck AT_SYSINFO return regs\n");
-	test_sys32_regs(do_full_vsyscall32);
+	if (vsyscall32) {
+		printf("[RUN]\tCheck AT_SYSINFO return regs\n");
+		test_sys32_regs(do_full_vsyscall32);
+	} else {
+		printf("[SKIP]\tAT_SYSINFO is not available\n");
+	}
 #endif
 
 	test_ptrace_syscall_restart();