s390/pai: Support CPU hotplug for PMU PAI
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
s390/pai: Support CPU hotplug for PMU PAI
The command 'perf stat -e pai_crypto/CRYPTO_ALL/ -- <command>' crashes the kernel when CPUs are hotplug added during that run.
Root cause is the missing allocation of per-CPU data structures for that new CPU. The allocation is dynamic and the first event that has task context creates such a structure for each online CPU. This is not sufficient. CPUs may be offline during event creation and can be set online during the perf run time. For example commands
# echo 0 > /sys/devices/system/cpu/cpu1/online # perf stat -e cycles -i -- stress-ng -t10s --matrix X # sleep 1 # echo 1 > /sys/devices/system/cpu/cpu1/online
Currently without a CPU hotplug handler, that new CPU has no per-CPU data infrastructure. The scheduler runs PMU call back function pai_add() to install the PMU support for that CPU before the task is being scheduled on that new CPU. In pai_add() instructions
mp = this_cpu_ptr(pai_root[idx].mapptr); cpump = mp->mapptr;
return a NULL pointer and the result is a kernel panic as variable cpump is used inside that function.
From the CVE record · Linux
The Linux kernel’s s390 PAI PMU can lack per-CPU data for a CPU brought online after a PAI performance event starts. A local user running the described perf command while CPUs are hotplugged can trigger a kernel panic; the input does not specify authentication requirements.
Engineers running Linux kernels with the s390 PAI PMU should check their deployments; affected versions are not specified.