From: Catalin Marinas <catalin.marinas@arm.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
Mark Brown <broonie@kernel.org>, Will Deacon <will@kernel.org>,
Emanuele Rocca <emanuele.rocca@arm.com>,
Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH 2/3] arm64: gcs: Allow PAGE_NONE mappings for NUMA balancing
Date: Fri, 20 Feb 2026 19:52:53 +0000 [thread overview]
Message-ID: <aZi7lYLdOtGdzxC9@arm.com> (raw)
In-Reply-To: <650c2324-8caa-49c5-940f-982e8c8b9965@kernel.org>
On Fri, Feb 20, 2026 at 05:16:52PM +0100, David Hildenbrand wrote:
> On 2/20/26 15:05, Catalin Marinas wrote:
> > diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
> > index 2e404441063b..f8993e3fa5d1 100644
> > --- a/arch/arm64/mm/mmap.c
> > +++ b/arch/arm64/mm/mmap.c
> > @@ -87,7 +87,15 @@ pgprot_t vm_get_page_prot(vm_flags_t vm_flags)
> > /* Short circuit GCS to avoid bloating the table. */
> > if (system_supports_gcs() && (vm_flags & VM_SHADOW_STACK)) {
> > - prot = pgprot_val(PAGE_GCS_RO);
> > + /*
> > + * Allow PAGE_NONE for NUMA balancing, otherwise use
> > + * PAGE_GCS_RO. The permission will be made writeable
> > + * (PAGE_GCS) on a GCS fault.
> > + */
> > + if (vm_flags & (VM_READ | VM_WRITE))
>
> Could consider using VM_ACCESS_FLAGS here. For Shadow stacks we'd never
> expect executable properties.
Yes, this is better.
> > + prot = pgprot_val(PAGE_GCS_RO);
> > + else
> > + prot = pgprot_val(protection_map[VM_NONE]);
>
> change_protection() documents that "This is assuming that NUMA faults are
> handled using PROT_NONE. If an architecture makes a different choice, it
> will need further changes to the core."
>
> So task_numa_work()->change_prot_numa()->change_protection() passes "newprot
> = PAGE_NONE".
>
> Where is the vm_get_page_prot() called on that path where your change would
> make a difference?
>
> I'd thing that vm_get_page_prot() gets only invoked through a "proper"
> mpotect() in mprotect_fixup()->vma_set_page_prot()...->vm_get_page_prot(),
> not for NUMA hinting that leaves the VMA untouched.
>
> OTOH, I wonder whether mprotect(PROT_NONE) could trigger the path you
> thought of above.
I started with the mprotect(PROT_NONE) in mind but thought the NUMA case
is a better argument. You are right, it doesn't use the same path.
I need to check what we do with mprotect(PROT_NONE). If it's not
rejected somewhere on the path to change_protect(), we end up with an
accessible GCS mapping. Maybe it doesn't matter much but I'd rather have
the access disabled. Anyway, I'll write some test next week to see what
it does. The above comment will need to be changed.
Thanks for the review.
--
Catalin
next prev parent reply other threads:[~2026-02-20 19:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-20 14:05 [PATCH 0/3] arm64: Assorted GCS fixes Catalin Marinas
2026-02-20 14:05 ` [PATCH 1/3] arm64: gcs: Do not set PTE_SHARED on GCS mappings if FEAT_LPA2 is enabled Catalin Marinas
2026-02-20 15:56 ` David Hildenbrand (Arm)
2026-02-20 16:45 ` Catalin Marinas
2026-02-20 16:47 ` Catalin Marinas
2026-02-20 14:05 ` [PATCH 2/3] arm64: gcs: Allow PAGE_NONE mappings for NUMA balancing Catalin Marinas
2026-02-20 16:16 ` David Hildenbrand (Arm)
2026-02-20 19:52 ` Catalin Marinas [this message]
2026-02-20 14:05 ` [PATCH 3/3] arm64: gcs: Do not map the guarded control stack as THP Catalin Marinas
2026-02-20 14:34 ` Mark Brown
2026-02-20 15:13 ` Catalin Marinas
2026-02-20 16:17 ` Mark Brown
2026-02-20 15:33 ` David Hildenbrand (Arm)
2026-02-20 15:36 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aZi7lYLdOtGdzxC9@arm.com \
--to=catalin.marinas@arm.com \
--cc=broonie@kernel.org \
--cc=david@kernel.org \
--cc=emanuele.rocca@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox