aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/proc/proc-pid-vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/proc/proc-pid-vm.c')
-rw-r--r--tools/testing/selftests/proc/proc-pid-vm.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/testing/selftests/proc/proc-pid-vm.c b/tools/testing/selftests/proc/proc-pid-vm.c
index 853aa164a401..18a3bde8bc96 100644
--- a/tools/testing/selftests/proc/proc-pid-vm.c
+++ b/tools/testing/selftests/proc/proc-pid-vm.c
@@ -215,6 +215,11 @@ static const char str_vsyscall[] =
215"ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]\n"; 215"ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]\n";
216 216
217#ifdef __x86_64__ 217#ifdef __x86_64__
218static void sigaction_SIGSEGV(int _, siginfo_t *__, void *___)
219{
220 _exit(1);
221}
222
218/* 223/*
219 * vsyscall page can't be unmapped, probe it with memory load. 224 * vsyscall page can't be unmapped, probe it with memory load.
220 */ 225 */
@@ -231,11 +236,19 @@ static void vsyscall(void)
231 if (pid == 0) { 236 if (pid == 0) {
232 struct rlimit rlim = {0, 0}; 237 struct rlimit rlim = {0, 0};
233 (void)setrlimit(RLIMIT_CORE, &rlim); 238 (void)setrlimit(RLIMIT_CORE, &rlim);
239
240 /* Hide "segfault at ffffffffff600000" messages. */
241 struct sigaction act;
242 memset(&act, 0, sizeof(struct sigaction));
243 act.sa_flags = SA_SIGINFO;
244 act.sa_sigaction = sigaction_SIGSEGV;
245 (void)sigaction(SIGSEGV, &act, NULL);
246
234 *(volatile int *)0xffffffffff600000UL; 247 *(volatile int *)0xffffffffff600000UL;
235 exit(0); 248 exit(0);
236 } 249 }
237 wait(&wstatus); 250 waitpid(pid, &wstatus, 0);
238 if (WIFEXITED(wstatus)) { 251 if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) == 0) {
239 g_vsyscall = true; 252 g_vsyscall = true;
240 } 253 }
241} 254}