aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-05-03 16:43:00 +0000
committerMark Johnston <markj@FreeBSD.org>2021-05-03 17:24:30 +0000
commitcdfcfc607acc10c8b1b2b6a427c9e1ed7e94ebb3 (patch)
treeef130330bc87fa9e27651ccd592926668176cb5c
parent02e7a6514e63ceca680fade40797280aef1bf55f (diff)
downloadsrc-cdfcfc607acc10c8b1b2b6a427c9e1ed7e94ebb3.tar.gz
src-cdfcfc607acc10c8b1b2b6a427c9e1ed7e94ebb3.zip
smp: Initialize arg->cpus sooner in smp_rendezvous_cpus_retry()
Otherwise, if !smp_started is true, then smp_rendezvous_cpus_done() will harmlessly perform an atomic RMW on an uninitialized variable. Reported by: KMSAN MFC after: 1 week Sponsored by: The FreeBSD Foundation
-rw-r--r--sys/kern/subr_smp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 093622d8f6aa..d4f8aac9e751 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -895,6 +895,8 @@ smp_rendezvous_cpus_retry(cpuset_t map,
{
int cpu;
+ CPU_COPY(&map, &arg->cpus);
+
/*
* Only one CPU to execute on.
*/
@@ -914,7 +916,6 @@ smp_rendezvous_cpus_retry(cpuset_t map,
* Execute an action on all specified CPUs while retrying until they
* all acknowledge completion.
*/
- CPU_COPY(&map, &arg->cpus);
for (;;) {
smp_rendezvous_cpus(
arg->cpus,