mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Call rcu_barrier earlier in the destructor
If a call_rcu thread is running, there is a possible race condition where the destructors run before all call_rcu callbacks have finished running. This can happen, for example, if the call_rcu callback tries to log something after the logging context has been torn down. In !10394, we tried to counter this by explicitely creating a call_rcu thread an shutting it down before running the destructors, but it is possible for things to "slip" and end up on the default call_rcu thread. As a quickfix, this commit moves an rcu_barrier() that was in the mem context destructor earlier, so that it "protects" all libisc destructors.
This commit is contained in:
parent
336c9d5114
commit
59086c33e2
@ -67,6 +67,9 @@ isc__lib_shutdown(void) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rcu_barrier();
|
||||||
|
rcu_unregister_thread();
|
||||||
|
|
||||||
isc__iterated_hash_shutdown();
|
isc__iterated_hash_shutdown();
|
||||||
isc__xml_shutdown();
|
isc__xml_shutdown();
|
||||||
isc__uv_shutdown();
|
isc__uv_shutdown();
|
||||||
@ -75,6 +78,4 @@ isc__lib_shutdown(void) {
|
|||||||
isc__mem_shutdown();
|
isc__mem_shutdown();
|
||||||
isc__mutex_shutdown();
|
isc__mutex_shutdown();
|
||||||
isc__os_shutdown();
|
isc__os_shutdown();
|
||||||
/* should be after isc__mem_shutdown() which calls rcu_barrier() */
|
|
||||||
rcu_unregister_thread();
|
|
||||||
}
|
}
|
||||||
|
@ -434,10 +434,9 @@ isc__mem_initialize(void) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
isc__mem_shutdown(void) {
|
isc__mem_shutdown(void) {
|
||||||
|
/* should be called after an rcu_barrier() */
|
||||||
bool empty;
|
bool empty;
|
||||||
|
|
||||||
rcu_barrier();
|
|
||||||
|
|
||||||
isc__mem_checkdestroyed();
|
isc__mem_checkdestroyed();
|
||||||
|
|
||||||
LOCK(&contextslock);
|
LOCK(&contextslock);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user