Reading the manual, PTRACE_INTERRUPT will interrupt a task that's executing a system call (which will be restarted once the task is restarted).
However, tgkill mentions nothing about this; what is the effects of tgkill sending a signal to a task currently executing a system call. Will it also abort the system call?
Short answer: yes.
Longer answer: it depends on a few factors. Some system calls can't be interrupted, and signal dispatch will wait until they have completed (just like with every other program). When the thread is currently in a system call that can be interrupted, then the behavior depends on what signal handler / mask the process has installed.
SIGTERMby default), that takes precedent, and your process is gone.To demonstrate this, take the following simple example code (
pthread_killusestgkillinternally):(sleep returns the amount of seconds it didn't sleep if it was interrupted, otherwise 0.)