diff options
author | Mark Brown <broonie@kernel.org> | 2019-07-24 17:00:06 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-07-24 17:00:06 +0100 |
commit | 27988c96687667e74df1a9a3b8662519bc1c29c9 (patch) | |
tree | 0aa67d365e8d544bf48a4de9ae94d7f8536de073 /tools/testing/selftests/proc/proc-pid-vm.c | |
parent | 8f46e22b5ac692b48d04bb722547ca17b66dda02 (diff) | |
parent | 5f9e832c137075045d15cd6899ab0505cfb2ca4b (diff) |
Merge tag 'v5.3-rc1' into regulator-5.3
Linus 5.3-rc1
Diffstat (limited to 'tools/testing/selftests/proc/proc-pid-vm.c')
-rw-r--r-- | tools/testing/selftests/proc/proc-pid-vm.c | 17 |
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[] = "ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]\n"; #ifdef __x86_64__ +static void sigaction_SIGSEGV(int _, siginfo_t *__, void *___) +{ + _exit(1); +} + /* * vsyscall page can't be unmapped, probe it with memory load. */ @@ -231,11 +236,19 @@ static void vsyscall(void) if (pid == 0) { struct rlimit rlim = {0, 0}; (void)setrlimit(RLIMIT_CORE, &rlim); + + /* Hide "segfault at ffffffffff600000" messages. */ + struct sigaction act; + memset(&act, 0, sizeof(struct sigaction)); + act.sa_flags = SA_SIGINFO; + act.sa_sigaction = sigaction_SIGSEGV; + (void)sigaction(SIGSEGV, &act, NULL); + *(volatile int *)0xffffffffff600000UL; exit(0); } - wait(&wstatus); - if (WIFEXITED(wstatus)) { + waitpid(pid, &wstatus, 0); + if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) == 0) { g_vsyscall = true; } } |