[PATCH v2 0/4] KVM: arm64: vcpu sysreg accessor rework
Marc Zyngier
maz at kernel.org
Tue Jun 3 23:54:55 PDT 2025
On Tue, 03 Jun 2025 22:06:27 +0100,
Oliver Upton <oliver.upton at linux.dev> wrote:
>
> On Tue, Jun 03, 2025 at 08:08:20AM +0100, Marc Zyngier wrote:
> > This series tries to bring some sanity to the way the RESx masks
> > are applied when accessing the in-memory view of the guest's
> > system registers.
> >
> > Currently, we have *one* accessor (__vcpu_sys_reg()) that can either
> > be used as a rvalue or lvalue while that applies the RESx masks behind
> > the scenes. This works fine when used as a rvalue.
> >
> > However, when used as a lvalue, it does the wrong thing, as it only
> > sanitises the value we're about to overwrite. This is pointless work
> > and potentially hides bugs.
> >
> > I propose that we move to a set of store-specific accessors (for
> > assignments and RMW) instead of the lvalue hack, ensuring that the
> > assigned value is the one that gets sanitised. This then allows the
> > legacy accessor to be converted to rvalue-only.
>
> Very happy with how this is shaping up.
>
> > Given the level of churn this introduces, I'd like this to land very
> > early in the cycle. Either before 6.16-rc2, or early in 6.17.
>
> What's your mood on sneaking this in as a fix for 6.16? It'd fix the
> unmasked write bug you mention and hopefully give a semi-stable / early
> base for building the 6.17 content on top off.
I'm absolutely in favour of taking this in ASAP. The impact should be
minimal for new code (and trivial to fix). I'll send this to Paolo by
the end of the week, or early next week at the latest.
> Otherwise this will be the very first thing I take for 6.17.
>
> Reviewed-by: Oliver Upton <oliver.upton at linux.dev>
Thanks!
M.
--
Jazz isn't dead. It just smells funny.
More information about the linux-arm-kernel
mailing list