aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@kernel.org>2018-03-17 11:25:07 -0400
committerIngo Molnar <mingo@kernel.org>2018-03-19 04:06:15 -0400
commit4b0b37d4cc54b21a6ecad7271cbc850555869c62 (patch)
tree203a5cc77cd7cf0ecfee2e9d082022050aaed430 /tools
parentbb8c13d61a629276a162c1d2b1a20a815cbcfbb7 (diff)
selftests/x86/ptrace_syscall: Fix for yet more glibc interference
glibc keeps getting cleverer, and my version now turns raise() into more than one syscall. Since the test relies on ptrace seeing an exact set of syscalls, this breaks the test. Replace raise(SIGSTOP) with syscall(SYS_tgkill, ...) to force glibc to get out of our way. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kselftest@vger.kernel.org Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/bc80338b453afa187bc5f895bd8e2c8d6e264da2.1521300271.git.luto@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/x86/ptrace_syscall.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/testing/selftests/x86/ptrace_syscall.c b/tools/testing/selftests/x86/ptrace_syscall.c
index 1ae1c5a7392e..6f22238f3217 100644
--- a/tools/testing/selftests/x86/ptrace_syscall.c
+++ b/tools/testing/selftests/x86/ptrace_syscall.c
@@ -183,8 +183,10 @@ static void test_ptrace_syscall_restart(void)
183 if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) 183 if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0)
184 err(1, "PTRACE_TRACEME"); 184 err(1, "PTRACE_TRACEME");
185 185
186 pid_t pid = getpid(), tid = syscall(SYS_gettid);
187
186 printf("\tChild will make one syscall\n"); 188 printf("\tChild will make one syscall\n");
187 raise(SIGSTOP); 189 syscall(SYS_tgkill, pid, tid, SIGSTOP);
188 190
189 syscall(SYS_gettid, 10, 11, 12, 13, 14, 15); 191 syscall(SYS_gettid, 10, 11, 12, 13, 14, 15);
190 _exit(0); 192 _exit(0);
@@ -301,9 +303,11 @@ static void test_restart_under_ptrace(void)
301 if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) 303 if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0)
302 err(1, "PTRACE_TRACEME"); 304 err(1, "PTRACE_TRACEME");
303 305
306 pid_t pid = getpid(), tid = syscall(SYS_gettid);
307
304 printf("\tChild will take a nap until signaled\n"); 308 printf("\tChild will take a nap until signaled\n");
305 setsigign(SIGUSR1, SA_RESTART); 309 setsigign(SIGUSR1, SA_RESTART);
306 raise(SIGSTOP); 310 syscall(SYS_tgkill, pid, tid, SIGSTOP);
307 311
308 syscall(SYS_pause, 0, 0, 0, 0, 0, 0); 312 syscall(SYS_pause, 0, 0, 0, 0, 0, 0);
309 _exit(0); 313 _exit(0);