You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alarm(): fix crash when alarm is rearmed from alarm handler
It is quite common for applications to set an alarm() and when it expires,
set a new alarm() from the signal handler. For example, this is what the
ping application does, and before this patch it often crashes after a
random number of times doing this.
The problem starts with alarm() wanting to know which thread ran it.
It needs this information so when an alarm happens it can interrupt a
system call sleeping in this specific thread. But unfortunately, when
alarm() runs from a signal handler (as described above), in OSv this
signal handler is a separate transient thread. Before this patch, we
remember *this* thread, and when the alarm next happens we try to wake
that thread, which no longer exists at that time. The result is of course
undefined, and depending on what else happened since, may result in a crash.
The solution in this patch is for alarm() not to change the old owner
thread if called from a signal handler thread. We *hope* that the previous
one is still relevant, and it will be true for most applications such as
ping. This workaround is kind of ugly, but it does fix the ping crash
described in issue 1073.
Fixes#1073.
Signed-off-by: Nadav Har'El <[email protected]>
Message-Id: <[email protected]>
0 commit comments