Re: [PATCH v10 18/40] arm64/mm: Handle GCS data aborts

Mark Brown
2024-08-19T15:14:50Z

[-- Attachment #1: Type: text/plain, Size: 972 bytes --]

On Mon, Aug 19, 2024 at 10:17:52AM +0100, Catalin Marinas wrote:
> On Thu, Aug 01, 2024 at 01:06:45PM +0100, Mark Brown wrote:

> > +static bool is_invalid_gcs_access(struct vm_area_struct *vma, u64 esr)
> > +{

> > + if (unlikely(is_gcs_fault(esr))) {
> > + /* GCS accesses must be performed on a GCS page */
> > + if (!(vma->vm_flags & VM_SHADOW_STACK))
> > + return true;
> > + if (!(vma->vm_flags & VM_WRITE))
> > + return true;

> Do we need the VM_WRITE check here? Further down in do_page_fault(), we
> already do the check as we set vm_flags = VM_WRITE.

> > if (!(vma->vm_flags & vm_flags)) {
> > vma_end_read(vma);
> > fault = 0;

It looks bitrotted, yes.

> I was wondering whether we should prevent mprotect(PROT_READ) on the GCS
> page. But I guess that's fine, we'll SIGSEGV later if we get an invalid
> GCS access.

Yeah, that doesn't seem like a particular problem - the concern is
adding rather than removing GCS.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]