From 462175659674a10c0d39c7c328f1a5324ce2e38b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Tue, 13 Nov 2018 13:50:47 +0100 Subject: [PATCH 1/2] Fix a shutdown race in bin/dig/dighost.c If a tool using the routines defined in bin/dig/dighost.c is sent an interruption signal around the time a connection timeout is scheduled to fire, connect_timeout() may be executed after destroy_libs() detaches from the global task (setting 'global_task' to NULL), which results in a crash upon a UDP retry due to bringup_timer() attempting to create a timer with 'task' set to NULL. Fix by preventing connect_timeout() from attempting a retry when shutdown is in progress. --- bin/dig/dighost.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index f4e5e55ae6..410b63435b 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -2902,6 +2902,11 @@ connect_timeout(isc_task_t *task, isc_event_t *event) { INSIST(!free_now); + if (cancel_now) { + UNLOCK_LOOKUP; + return; + } + if ((query != NULL) && (query->lookup->current_query != NULL) && ISC_LINK_LINKED(query->lookup->current_query, link) && (ISC_LIST_NEXT(query->lookup->current_query, link) != NULL)) { From ae40e8039be1f8f21e5886eb4ddf3a8ffc9c1361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Tue, 13 Nov 2018 13:50:47 +0100 Subject: [PATCH 2/2] Add CHANGES entry 5088. [bug] dig/host/nslookup could crash when interrupted close to a query timeout. [GL #599] --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index 56dbd992b9..aba9093b7b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +5088. [bug] dig/host/nslookup could crash when interrupted close to + a query timeout. [GL #599] + 5087. [test] Check that result tables are complete. [GL #676] 5086. [func] Log of RPZ now includes the QTYPE and QCLASS. [GL #623]