Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Commit b754c66

Browse files
committed
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.
1 parent 4203e16 commit b754c66

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.tsan-suppress-extra

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ called_from_lib:libfstrm.so
33
called_from_lib:libdummyrpz.so
44
# be more selective with liburcu
55
race:rcu_barrier
6-
race:rcu_memb_barrier
6+
race:rcu_*_barrier
77
thread:*

lib/dns/qp.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,14 +1431,22 @@ static void
14311431
qpmulti_destroy_cb(struct rcu_head *arg) {
14321432
qp_rcuctx_t *rcuctx = isc_urcu_container(arg, qp_rcuctx_t, rcu_head);
14331433
REQUIRE(QPRCU_VALID(rcuctx));
1434+
/* only nonzero for reclaim_chunks_cb() */
1435+
REQUIRE(rcuctx->count == 0);
1436+
14341437
dns_qpmulti_t *multi = rcuctx->multi;
14351438
REQUIRE(QPMULTI_VALID(multi));
1439+
1440+
/* reassure thread sanitizer */
1441+
LOCK(&multi->mutex);
1442+
14361443
dns_qp_t *qp = &multi->writer;
14371444
REQUIRE(QP_VALID(qp));
14381445

1439-
REQUIRE(rcuctx->count == 0);
1440-
14411446
destroy_guts(qp);
1447+
1448+
UNLOCK(&multi->mutex);
1449+
14421450
isc_mutex_destroy(&multi->mutex);
14431451
isc_mem_putanddetach(&rcuctx->mctx, rcuctx,
14441452
STRUCT_FLEX_SIZE(rcuctx, chunk, rcuctx->count));

0 commit comments

Comments
 (0)