mirror of
https://github.com/troglobit/finit.git
synced 2026-10-08 08:24:43 +07:00
Do not try to SIGKILL inetd services, they are not backed by a pid
As a precaution, services who are being stopped are automatically sent a SIGKILL after 3 seconds if they refuse to go away willingly. Unfortunately this backup mechanism was also enabled for inetd services which are not backed by a real process. When the service was freed the timer was not stopped, since it was not expected to be armed. The timer would then trigger, causing a use-after-free on the timer watcher containing a bogus callback pointer.
This commit is contained in:
+2
-1
@@ -966,7 +966,8 @@ static void svc_set_state(svc_t *svc, svc_state_t new)
|
||||
*state = new;
|
||||
|
||||
/* if the PID isn't collected within 3s, kill it! */
|
||||
if (*state == SVC_STOPPING_STATE) {
|
||||
if ((*state == SVC_STOPPING_STATE) &&
|
||||
!svc_is_inetd(svc)) {
|
||||
service_timeout_cancel(svc);
|
||||
service_timeout_after(svc, 3000, service_kill);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user