Interruptible sleeps (sleepq_catch_signals()) are aborted when the
thread has a pending suspension request, e.g. when another thread
single-threads the process for a core dump, fork or exec, or on a stop
signal. signal_pending() however only looked at the signal sets, so
LinuxKPI wait loops such as
while (!condition) {
if (signal_pending(current)) return (-ERESTARTSYS); schedule_timeout(...);
}
re-entered the sleep immediately, got aborted again, and spun at 100%
CPU without ever reaching the user boundary where the thread could
suspend. The single-threading thread then waited forever.
This was seen with amdkfd: a HIP process that aborted (SIGABRT with a
core dump) hung with two threads spinning in kfd_wait_on_events().
Also report a pending signal when TDA_SUSPEND is pending, so the
caller returns -ERESTARTSYS, the thread suspends, and the system call
is restarted afterwards.
Tested with an HSA program that aborts: it now dumps core and exits
promptly.