mm: add arch hook to validate mmap() prot flags
authorArd Biesheuvel <ardb@kernel.org>
Wed, 14 Feb 2024 12:29:28 +0000 (13:29 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 16 Feb 2024 12:42:43 +0000 (12:42 +0000)
commitcb1a393c40eee2f1692c995ea0cc6e45bfccde4d
treecdb22e3f9f77883f442ad3f1e279c5040309751f
parent5d101654226d64ac0a6928019fbf476b46e9d14b
mm: add arch hook to validate mmap() prot flags

Add a hook to permit architectures to perform validation on the prot
flags passed to mmap(), like arch_validate_prot() does for mprotect().
This will be used by arm64 to reject PROT_WRITE+PROT_EXEC mappings on
configurations that run with WXN enabled.

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20240214122845.2033971-87-ardb+git@google.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
include/linux/mman.h
mm/mmap.c