Re: [PATCH v19 06/14] KVM: arm64: Validate GCS exception lock when emulating ERET
From: Wei-Lin Chang
Date: Sun Aug 23 2026 - 09:18:40 EST
On Fri, Aug 21, 2026 at 11:19:30PM +0100, Mark Brown wrote:
> On Fri, Aug 21, 2026 at 03:32:58PM +0100, Wei-Lin Chang wrote:
> > On Wed, Aug 12, 2026 at 08:12:05PM +0100, Mark Brown wrote:
>
> > > +/*
> > > + * A subset of the pseudocode ELFromSPSR(), validity checks are
> > > + * assumed to have been done in code that is not GCS specific.
> > > + */
> > > +static inline int exlock_el_from_spsr(u64 spsr)
> > > +{
> > > + return FIELD_GET(GENMASK(3, 2), spsr);
> > > +}
>
> > It feels a bit odd to me to have this function named exlock specific, as
> > it's just spsr_to_el, right?
>
> As the comment mentions it's not quite that - ELFromSPSR() in the
> pseudocode has rather more going on in it that I'd managed to convince
> myself wasn't relevant in this specific context. I didn't want to give
> it a name that would cause someone to think it did the full thing and
> trip them up using it in a different context where those things do
> matter. I do agree that this results in awkward naming.
Right sorry, I missed the pseudocode part. ELFromSPSR pseudocode is
doing more than what its name indicates...
If we want to stick with the pseudocode then what do you think about
el_from_spsr_nocheck/el_from_spsr_raw?
>
> Please delete unneeded context from mails when replying. Doing this
> makes it much easier to find your reply in the message, helping ensure
> it won't be missed by people scrolling through the irrelevant quoted
> material.
Ok, thanks for the reminder!
Thanks,
Wei-Lin Chang