diff options
author | Mark Johnston <markj@FreeBSD.org> | 2022-06-20 15:50:54 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2022-06-20 16:48:13 +0000 |
commit | a932a5a649823fda05e89f7757cc59339da8e2aa (patch) | |
tree | 3a16b677f79549a574aac7130865c9415584045d | |
parent | 3b2956781048f300c081952150d515573a274620 (diff) | |
download | src-a932a5a649823fda05e89f7757cc59339da8e2aa.tar.gz src-a932a5a649823fda05e89f7757cc59339da8e2aa.zip |
uma: Mark zeroed slabs as initialized for KMSAN
Otherwise zone initializers can produce false positives, e.g., when
lock_init() attempts to detect double initialization.
Sponsored by: The FreeBSD Foundation
-rw-r--r-- | sys/vm/uma_core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index dfa3138a34f9..8502719cac72 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1805,6 +1805,9 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int flags, if ((keg->uk_flags & UMA_ZFLAG_HASH) != 0) domain = 0; + kmsan_mark(mem, size, + (aflags & M_ZERO) != 0 ? KMSAN_STATE_INITED : KMSAN_STATE_UNINIT); + /* Point the slab into the allocated memory */ if (!(keg->uk_flags & UMA_ZFLAG_OFFPAGE)) slab = (uma_slab_t)(mem + keg->uk_pgoff); |