]> git.ipfire.org Git - thirdparty/linux.git/commit
arm64: gcs: Honour mprotect(PROT_NONE) on shadow stack mappings
authorCatalin Marinas <catalin.marinas@arm.com>
Mon, 23 Feb 2026 17:45:31 +0000 (17:45 +0000)
committerWill Deacon <will@kernel.org>
Wed, 25 Feb 2026 19:53:58 +0000 (19:53 +0000)
commit47a8aad135ac1aed04b7b0c0a8157fd208075827
tree7f4145ead93b69aeaf87d1da79217ac98f1c25d5
parent8a85b3131225a8c8143ba2ae29c0eef8c1f9117f
arm64: gcs: Honour mprotect(PROT_NONE) on shadow stack mappings

vm_get_page_prot() short-circuits the protection_map[] lookup for a
VM_SHADOW_STACK mapping since it uses a different PIE index from the
typical read/write/exec permissions. However, the side effect is that it
also ignores mprotect(PROT_NONE) by creating an accessible PTE.

Special-case the !(vm_flags & VM_ACCESS_FLAGS) flags to use the
protection_map[VM_NONE] permissions instead. No GCS attributes are
required for an inaccessible PTE.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Fixes: 6497b66ba694 ("arm64/mm: Map pages for guarded control stack")
Cc: stable@vger.kernel.org
Cc: Mark Brown <broonie@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/mm/mmap.c