Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Apr 2023 15:19:24 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 6eca9db1e7a5 - main - busdma: Update KMSAN shadow maps later in bounce_bus_dmamap_sync()
Message-ID:  <202304281519.33SFJOpZ046021@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=6eca9db1e7a52b1060c8999cafb5cb088854aabb

commit 6eca9db1e7a52b1060c8999cafb5cb088854aabb
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-04-28 14:49:25 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-04-28 14:59:01 +0000

    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
---
 sys/x86/x86/busdma_bounce.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c
index cf919c01ca64..7f488198e2c0 100644
--- a/sys/x86/x86/busdma_bounce.c
+++ b/sys/x86/x86/busdma_bounce.c
@@ -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 @@ next_r:
 	}
 out:
 	atomic_thread_fence_rel();
+	if (map != NULL)
+		kmsan_bus_dmamap_sync(&map->kmsan_mem, op);
 }
 
 #ifdef KMSAN



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304281519.33SFJOpZ046021>