[PATCH v2 11/11] KVM: arm64: Get rid of the AArch32 register mapping code

Marc Zyngier maz at kernel.org
Thu May 23 11:18:57 PDT 2024


On Thu, 23 May 2024 17:19:38 +0100,
Nina Schoetterl-Glausch <nsg at linux.ibm.com> wrote:
> 
> On Thu, 2024-05-23 at 17:04 +0100, Marc Zyngier wrote:
>
> > Amazing. Thanks for spotting this. This is indeed broken. I guess this
> > was not spotted because userspace is not totally broken itself.
> 
> So it's an actual bug and not just doing more work than necessary?

Definitely.

> Could corrupt the regs of a 64bit kernel?

Yup. If you have a 64bit guest with a 32bit userspace, and that you
restore the state at the point where the latter is live, with any
PSTATE bit set other than those in PSTATE.M, you corrupt the 64bit
GPRs by zeroing the top 32bit.

Linux as a guest is probably fine as it doesn't try to optimise the
GPR save/restore for a 32bit userspace and will restore the registers
from its stack (which itself is not corrupted), but that's still a
pretty bad situation.

> > Do you want to submit a fix adding the masking back? or should I do it
> > myself?
> 
> You go ahead and do it :)

Will do shortly.

Thanks again,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list