]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
arm64: cpufeature: Make PMUVer and PerfMon unsigned
authorJames Clark <james.clark@linaro.org>
Thu, 5 Mar 2026 16:28:18 +0000 (16:28 +0000)
committerWill Deacon <will@kernel.org>
Tue, 24 Mar 2026 12:33:49 +0000 (12:33 +0000)
commitd1dcc20bcc40efe1f1c71639376c91dafa489222
treee577a2e7d486decd516ce09713e5c4f0de11bd2d
parent2e30447b233a8e7a561bb51995b8d4944282bf62
arm64: cpufeature: Make PMUVer and PerfMon unsigned

On the host, this change doesn't make a difference because the fields
are defined as FTR_EXACT. However, KVM allows userspace to set these
fields for a guest and overrides the type to be FTR_LOWER_SAFE. And
while KVM used to do an unsigned comparison to validate that the new
value is lower than what the hardware provides, since the linked commit
it uses the generic sanitization framework which does a signed
comparison.

Fix it by defining these fields as unsigned. In theory, without this
fix, userspace could set a higher PMU version than the hardware supports
by providing any value with the top bit set.

Fixes: c118cead07a7 ("KVM: arm64: Use generic sanitisation for ID_(AA64)DFR0_EL1")
Signed-off-by: James Clark <james.clark@linaro.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Colton Lewis <coltonlewis@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/cpufeature.c