Re: [PATCH v19 06/14] KVM: arm64: Validate GCS exception lock when emulating ERET

Wei-Lin Chang <[email protected]>
Newsgroups dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <q3lxbu2palhkejnkvncs2iili6vvkcl7boftn4snf4fjy6fhvg@ehrwmqt6eh3m>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.