git: 44d26e9e781f - stable/13 - smp: Initialize arg->cpus sooner in smp_rendezvous_cpus_retry()
Mark Johnston
markj at FreeBSD.org
Mon May 10 13:49:32 UTC 2021
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=44d26e9e781fdf47fe0e1e6c987d519a751b14fa
commit 44d26e9e781fdf47fe0e1e6c987d519a751b14fa
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-10 13:35:53 +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
Sponsored by: The FreeBSD Foundation
(cherry picked from commit cdfcfc607acc10c8b1b2b6a427c9e1ed7e94ebb3)
---
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-branches
mailing list