bind9/bin/named
Diego Fronza 9298dcebbd Fix deadlock between rndc addzone/delzone/modzone
It follows a description of the steps that were leading to the deadlock:

1. `do_addzone` calls `isc_task_beginexclusive`.

2. `isc_task_beginexclusive` waits for (N_WORKERS - 1) halted tasks,
   this blocks waiting for those (no. workers -1) workers to halt.
...
isc_task_beginexclusive(isc_task_t *task0) {
    ...
	while (manager->halted + 1 < manager->workers) {
		wake_all_queues(manager);
		WAIT(&manager->halt_cond, &manager->halt_lock);
	}
```

3. It is possible that in `task.c / dispatch()` a worker is running a
   task event, if that event blocks it will not allow this worker to
   halt.

4. `do_addzone` acquires `LOCK(&view->new_zone_lock);`,

5. `rmzone` event is called from some worker's `dispatch()`, `rmzone`
   blocks waiting for the same lock.

6. `do_addzone` calls `isc_task_beginexclusive`.

7. Deadlock triggered, since:
	- `rmzone` is wating for the lock.
	- `isc_task_beginexclusive` is waiting for (no. workers - 1) to
	   be halted
	- since `rmzone` event is blocked it won't allow the worker to halt.

To fix this, we updated do_addzone code to call isc_task_beginexclusive
before the lock is acquired, we postpone locking to the nearest required
place, same for isc_task_beginexclusive.

The same could happen with rndc modzone, so that was addressed as well.
2021-04-22 15:45:55 +00:00
..
include Initial support for DNS-over-HTTP(S) 2021-02-03 12:06:17 +01:00
unix Fix possible NULL dereference in cd->dlz_destroy() 2020-10-28 15:48:58 +01:00
win32 report libnghttp2 version in 'named -V' 2021-02-16 14:40:18 -08:00
.gitignore Complete rewrite the BIND 9 build system 2020-04-21 14:19:48 +02:00
bind9.xsl update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
builtin.c Generate PTR records for DNS64 mapped ipv4only.arpa reverses. 2020-12-11 14:17:52 +11:00
config.c Change default stale-answer-client-timeout to off 2021-04-07 14:10:31 +02:00
control.c Postpone the isc_app_shutdown() after rndc response has been sent 2020-10-22 11:46:58 -07:00
controlconf.c Silence CID 304936 Dereference before null check 2021-02-23 11:39:00 +00:00
fuzz.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
geoip.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
log.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
logconf.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
main.c Refactor taskmgr to run on top of netmgr 2021-04-20 23:22:28 +02:00
Makefile.am implement xfrin via XoT 2021-01-29 12:07:38 +01:00
named.conf.rst Add purge-keys config option 2021-02-23 09:16:48 +01:00
named.rst Initial support for DNS-over-HTTP(S) 2021-02-03 12:06:17 +01:00
server.c Fix deadlock between rndc addzone/delzone/modzone 2021-04-22 15:45:55 +00:00
statschannel.c Stop xmlFreeTextWriter being called twice 2021-01-28 04:15:06 +00:00
tkeyconf.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
transportconf.c refactor outgoing HTTP connection support 2021-03-05 13:29:26 +02:00
tsigconf.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
xsl_p.h Complete rewrite the BIND 9 build system 2020-04-21 14:19:48 +02:00
zoneconf.c implement xfrin via XoT 2021-01-29 12:07:38 +01:00