mirror of
https://github.com/troglobit/finit.git
synced 2026-11-08 16:11:10 +00: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:
1 parent
2759992dd2
commit
fd837a4242
1 file changed
+2
-1
+2
-1
@@ -966,7 +966,8 @@ static void svc_set_state(svc_t *svc, svc_state_t new)
|
|||||||
*state = new;
|
*state = new;
|
||||||
|
|
||||||
/* if the PID isn't collected within 3s, kill it! */
|
/* 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_cancel(svc);
|
||||||
service_timeout_after(svc, 3000, service_kill);
|
service_timeout_after(svc, 3000, service_kill);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user