itimer_thread_func doesn't handle EINTR when poll returns -1
Summary
An error (-1
) return of the call to poll
in itimer_thread_func
added in e5383a29 unconditionally results in sysErrorBelch
, even when the poll
failed because of EINTR
.
Normally, this can't happen, because the thread is set up with a signal mask for all blockable signals. However, in my Haskell Landlock bindings, libcap's psx library is used to ensure all threads in a process get landlocked, which relies on SIGSYS
being sent to all threads in a process and having a handler in place. To make this work, the library tells the linker to wrap sigfillset
with a version which ensures SIGSYS
is not masked, so poll
can return -1
with EINTR
in errno
.
Using TEMP_FAILURE_RETRY
(or a local equivalent) should fix this.
Steps to reproduce
Build and run the landlock-readme
test of rev a512fadb767e715d0f4f8ca59470d584775282c4 of landlock-hs
.
Expected behavior
Everything works as it did before e5383a29, where a "failed" read
would be checked for EINTR
and handled accordingly.
Environment
- GHC version used: 9.8.2
Optional:
- Operating System: Linux
- System Architecture: x86_64