]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: Ensure execute-only permissions are not allowed without EPAN
authorCatalin Marinas <catalin.marinas@arm.com>
Thu, 3 Mar 2022 18:00:44 +0000 (18:00 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Tue, 8 Mar 2022 10:03:51 +0000 (10:03 +0000)
commiteee19fef361ccbdca4da49646f039de3f2eba0a6
tree2c7c0ebd1e48ea7301b9674b0d75f7ced5acafe2
parentacaecaae82f4e99b1cb3775bd7915634e7fbfc83
arm64: Ensure execute-only permissions are not allowed without EPAN

Commit f5f5f2f7c857 ("arm64: Support execute-only permissions with
Enhanced PAN") re-introduced execute-only permissions when EPAN is
available. When EPAN is not available, arch_filter_pgprot() is supposed
to change a PAGE_EXECONLY permission into PAGE_READONLY_EXEC. However,
if BTI or MTE are present, such check does not detect the execute-only
pgprot in the presence of PTE_GP (BTI) or MT_NORMAL_TAGGED (MTE),
allowing the user to request PROT_EXEC with PROT_BTI or PROT_MTE.

Remove the arch_filter_pgprot() function, change the default VM_EXEC
permissions to PAGE_READONLY_EXEC and update the protection_map[] array
at core_initcall() if EPAN is detected.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Fixes: f5f5f2f7c857 ("arm64: Support execute-only permissions with Enhanced PAN")
Cc: <stable@vger.kernel.org> # 5.13.x
Acked-by: Will Deacon <will@kernel.org>
Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com>
arch/arm64/Kconfig
arch/arm64/include/asm/pgtable-prot.h
arch/arm64/include/asm/pgtable.h
arch/arm64/mm/mmap.c