git: cdfcfc607acc - main - smp: Initialize arg->cpus sooner in smp_rendezvous_cpus_retry()
Mark Johnston
markj at FreeBSD.org
Mon May 3 17:55:39 UTC 2021
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=cdfcfc607acc10c8b1b2b6a427c9e1ed7e94ebb3
commit cdfcfc607acc10c8b1b2b6a427c9e1ed7e94ebb3
Author: Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-05-03 16:43:00 +0000
Commit: Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-05-03 17:24:30 +0000
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
---
sys/kern/subr_smp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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,
More information about the dev-commits-src-main
mailing list