Page MenuHome GnuPG

agent: agent_kick_the_loop function to unblock the select(2)
Testing, WishlistPublic

Description

To implement timer functions in gpg-agent, we need to introduce an internal API to unblock the select(2) loop.
I'd like to propose the API agent_kick_the_loop, as we have already have similar implementation in scdaemon.

This function may be called by agent_timer_settimer, so that updated timer can be effective.

Revisions and Commits

Event Timeline

gniibe triaged this task as Wishlist priority.Aug 24 2023, 4:43 AM
gniibe created this task.

I confirmed that the pselect EINTR problem of Linux (at least for x86) has not yet been fixed: https://lkml.org/lkml/2018/3/21/909

Upon suspend-to-ram (or hibernate), kernel sends a fake signal to all user-space processes to be frozen. It expects that for a process doing syscall, the syscall is restarted.
When resumed, in scdaemon, one of threads may send SIGCONT to break the loop. In this situation, for the main thread of scdaemon, two signals are handled; one for a fake signal, another is real signal. The SIGCONT should break the select syscall, but in the situation of suspend->resume, because restarting syscall is prepared in the stack, the loop doesn't break.