Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check EINTR is handled correctly #211

Closed
talex5 opened this issue Apr 22, 2022 · 3 comments
Closed

Check EINTR is handled correctly #211

talex5 opened this issue Apr 22, 2022 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@talex5
Copy link
Collaborator

talex5 commented Apr 22, 2022

System calls need to be retried if they return EINTR (unless this was due to them being cancelled; you don't always get ECANCELED in that case).

There is some handling already, e.g. here's eio_linux handling EINTR for rw ops:

begin match Fiber_context.get_error action.fiber with
| Some e -> Suspended.discontinue action e (* If cancelled, report that instead. *)
| None ->
if errno_is_retry e then (
submit_rw_req st req;
schedule st
) else (
Suspended.continue action e
)

Check if we need this in more places, and also check the eio_luv backend.

@hannesm notes in mirage/mirage-crypto#155 (comment) that getrandom needs this too.

@haesbaert
Copy link
Contributor

We could also just enforce SA_RESTART.
Not sure how you feel about eio calling sigaction though.

@talex5
Copy link
Collaborator Author

talex5 commented Jul 25, 2022

Reading signal(7), it seems hard to avoid EINTR in all cases. In particular, it seems that SIGCONT can generate EINTR.

It's also a bit unclear to me what happens with signals and io_uring operations. I would expect that the io_uring_enter call would return EINTR rather than the individual operations, so maybe the retry logic above isn't even needed. That code has been there since the very first commit by @avsm; I don't know if it was needed for something.

@talex5 talex5 added enhancement New feature or request question Further information is requested labels Feb 6, 2023
@talex5
Copy link
Collaborator Author

talex5 commented Mar 28, 2023

As far as I know this is working correctly everywhere, so I'll close this. We can reopen if we find any remaining places we missed.

@talex5 talex5 closed this as completed Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants