busdma: Update KMSAN shadow maps later in bounce_bus_dmamap_sync()

Otherwise POSTREAD syncs may re-invalidate the shadow of the data buffer
when copying from bounce pages, resulting in false-positive KMSAN
reports.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2023-04-28 10:49:25 -04:00
parent 56f2446575
commit 6eca9db1e7

View File

@ -924,7 +924,6 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map,
if (map == NULL)
goto out;
kmsan_bus_dmamap_sync(&map->kmsan_mem, op);
if ((bpage = STAILQ_FIRST(&map->bpages)) == NULL)
goto out;
@ -1018,6 +1017,8 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map,
}
out:
atomic_thread_fence_rel();
if (map != NULL)
kmsan_bus_dmamap_sync(&map->kmsan_mem, op);
}
#ifdef KMSAN