Re: [PATCH v3 15/18] KVM: arm64: Reject host access to protected VM private state
From: Fuad Tabba
Date: Sun Sep 27 2026 - 08:38:21 EST
Hi Marc, Will,
On Sun, 27 Sep 2026 09:20:52 +0100, Marc Zyngier <maz@xxxxxxxxxx> wrote:
[...]
> > and it would be really helpful to discuss it on the list. As you probably
> > know, on Android, pKVM has the semantics you describe above: the ONE_REG
> > calls succeed, but the register state isn't propagated to the guest once
> > it's started running. I think we largely did it this way because we were
> > solving a million problems at once during the initial development and
> > having to pipe-clean VMMs wasn't particularly appealing at the time.
> > It's also worth adding that, to my knowledge, we've never had any issues
> > in Android because of this decision.
That's Android 15 (6.6). Android 16 and 17 reject ONE_REG once a
protected vCPU is finalized, except x0-x3 during one forwarded
hypercall so the VMM can complete it [1]. crosvm has shipped against
that on both.
[...]
> > If it's helpful, we can ask the crosvm developers here if they have
> > opinions for/against the two behaviours?
>
> I guess that'd be useful to know what they'd prefer, and also to look
> into what QEMU does in this case -- I'm not exactly a good judge when
> it comes to UAPI definition... ;-)
QEMU stops syncing registers once it has marked the guest state
protected [2] (bar the virtual counter save/restore on stop/cont), and
the QEMU CCA series sets that flag when the VM starts [3].
On the kernel side, the CCA series rejects a SET_ONE_REG for a realm
outside the GPRs, PC and two configuration registers with -EINVAL, and
lets GET return what its message calls "(stale)" values [4].
Given that, are you ok with v4 keeping the error? :D
Cheers,
/fuad
[1] https://android.googlesource.com/kernel/common/+/cfc696b1fb110
[2] https://gitlab.com/qemu-project/qemu/-/commit/5c3131c392f84c660033d511ec39872d8beb4b1e
[3] https://lore.kernel.org/all/20260903193611.1058589-5-mathieu.poirier@xxxxxxxxxx/
[4] https://lore.kernel.org/all/20260924160504.853911-23-suzuki.poulose@xxxxxxx/