Acquire qpmulti->mutex during destruction

Thread sanitizer warns that parts of the qp-trie are accessed
both with and without the mutex; the unlocked accesses happen during
destruction, so they should be benign, but there's no harm locking
anyway to convince tsan it is clean.

Also, ensure .tsan-suppress and .tsan-suppress-extra are in sync.
This commit is contained in:
Tony Finch
2023-05-17 10:57:16 +01:00
parent 4203e1643a
commit b754c6628f
2 changed files with 11 additions and 3 deletions

View File

@@ -3,5 +3,5 @@ called_from_lib:libfstrm.so
called_from_lib:libdummyrpz.so
# be more selective with liburcu
race:rcu_barrier
race:rcu_memb_barrier
race:rcu_*_barrier
thread:*

View File

@@ -1431,14 +1431,22 @@ static void
qpmulti_destroy_cb(struct rcu_head *arg) {
qp_rcuctx_t *rcuctx = isc_urcu_container(arg, qp_rcuctx_t, rcu_head);
REQUIRE(QPRCU_VALID(rcuctx));
/* only nonzero for reclaim_chunks_cb() */
REQUIRE(rcuctx->count == 0);
dns_qpmulti_t *multi = rcuctx->multi;
REQUIRE(QPMULTI_VALID(multi));
/* reassure thread sanitizer */
LOCK(&multi->mutex);
dns_qp_t *qp = &multi->writer;
REQUIRE(QP_VALID(qp));
REQUIRE(rcuctx->count == 0);
destroy_guts(qp);
UNLOCK(&multi->mutex);
isc_mutex_destroy(&multi->mutex);
isc_mem_putanddetach(&rcuctx->mctx, rcuctx,
STRUCT_FLEX_SIZE(rcuctx, chunk, rcuctx->count));