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

EINTR causes: sigwaitinfo failed: errno=4; Shutting down. #261

Closed
Allen-Webb opened this issue Oct 24, 2018 · 6 comments
Closed

EINTR causes: sigwaitinfo failed: errno=4; Shutting down. #261

Allen-Webb opened this issue Oct 24, 2018 · 6 comments

Comments

@Allen-Webb
Copy link
Contributor

Under some circumstances sigwaitinfo (and other syscalls) can get an EINTR which generally means the program should repeat the previous syscall because of an interrupt, so it might make sense to call sigwaitinfo again.

However, this might be intended behavior or better left as is if usbguard were to lose track of uevents or other system state changes having it close on EINTR would give it the opportunity for the daemon to be respawned and pickup the current state instead of resuming with the old state. I am not convinced the state would get out of sync in practice,

You can trigger this behavior by the following:
sudo kill -SIGSTOP ${USBGUARD_PID}; sudo kill -SIGCONT ${USBGUARD_PID}
It isn't necessary to send a SIGSTOP though, an EINTR can happen for a variety of reasons, this is just an easy way to trigger the behavior. Ideally, if you want to handle EINTR, you would need to do it for a good number of the syscalls besides just sigwaitinfo.

@rathann
Copy link

rathann commented Sep 12, 2019

Is my downstream bug report related? https://bugzilla.redhat.com/show_bug.cgi?id=1751861 . I frequently get logs like this:

Sep 11 10:20:31 usbguard-daemon[11714]: sigwaitinfo failed: errno=4; Shutting down.

and find usbguard not running and my external keyboard/mouse not working after I leave my machine idling for over an hour.

@infokiller
Copy link

infokiller commented Oct 2, 2019

I can confirm what @rathann is seeing.
In my specific case it was even more painful, because it happened on a desktop computer with no built in keyboard, so I had to do a hard reboot to make the keyboard functional again.

@infokiller
Copy link

If I understand the code correctly, the big issue is that when this error happens, it doesn't affect the exit code of the process, which will always return success:

daemon.run();
ret = EXIT_SUCCESS;

And it seems that the systemd service is configured to only restart on failures:

Restart=on-failure

So it means that once this error happens, the systemd service will finish with success and not be restarted. I guess that as a workaround, I can systemd edit the service file to always restart.
As for a long term fix, is there any objection for a PR that makes the process exit with an error in this case?

@zuzzurro
Copy link

On my fedora 31 usbguard is basically useless as it keeps exiting. Is someone actually looking into this?

@genodeftest
Copy link
Contributor

On my fedora 31 usbguard is basically useless as it keeps exiting. Is someone actually looking into this?

There is an update, also for Fedora 31 but I now instead see issue #279 which breaks usbguard completely in my case.

@radosroka
Copy link
Member

From upstream point of view this seems to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants