diff options
author | Marc Zyngier <maz@kernel.org> | 2025-06-03 08:08:21 +0100 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2025-06-05 14:17:32 +0100 |
commit | 6678791ee3da0b78c28fe7d77814097f53cbb8df (patch) | |
tree | d2db955a4088aa3a9ea9991c901f1ce29678451d /lib/mpi/mpiutil.c | |
parent | 4d62121ce9b58ea23c8d62207cbc604e98ecdc0a (diff) |
KVM: arm64: Add assignment-specific sysreg accessor
Assigning a value to a system register doesn't do what it is
supposed to be doing if that register is one that has RESx bits.
The main problem is that we use __vcpu_sys_reg(), which can be used
both as a lvalue and rvalue. When used as a lvalue, the bit masking
occurs *before* the new value is assigned, meaning that we (1) do
pointless work on the old cvalue, and (2) potentially assign an
invalid value as we fail to apply the masks to it.
Fix this by providing a new __vcpu_assign_sys_reg() that does
what it says on the tin, and sanitises the *new* value instead of
the old one. This comes with a significant amount of churn.
Reviewed-by: Miguel Luis <miguel.luis@oracle.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20250603070824.1192795-2-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'lib/mpi/mpiutil.c')
0 files changed, 0 insertions, 0 deletions