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
This commit is contained in:
Mark Johnston 2021-05-03 12:43:00 -04:00
parent 02e7a6514e
commit cdfcfc607a

View File

@ -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,