[9.18] fix: dev: Fix data race on fctx->vresult in validated()

Move the write to fctx->vresult after LOCK(&fctx->lock).  The field was
being set before acquiring the lock, but dns_resolver_logfetch() reads
it under the same lock from another thread.

Backport of MR !11717

Merge branch 'backport-ondrej/fix-data-race-on-fctx-result-in-validated-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!11722
This commit is contained in:
Ondřej Surý 2026-03-20 03:23:49 +01:00
commit 5b7c54ae01

View file

@ -5662,6 +5662,7 @@ validated(isc_task_t *task, isc_event_t *event) {
bucketnum = fctx->bucketnum;
LOCK(&res->buckets[bucketnum].lock);
fctx->vresult = vevent->result;
ISC_LIST_UNLINK(fctx->validators, vevent->validator, link);
fctx->validator = NULL;
UNLOCK(&res->buckets[bucketnum].lock);