arm64/mm: fold check for KFENCE into can_set_direct_map()
authorMike Rapoport <rppt@linux.ibm.com>
Wed, 21 Sep 2022 07:48:41 +0000 (10:48 +0300)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 29 Sep 2022 16:59:28 +0000 (17:59 +0100)
commitb9dd04a20f81333e4b99662f1bbaf7c9e3a1e137
treeea68c3c97d9a48dedd5e4858e156f7d195ec2202
parent2305b809be930ce02e095ee7207e8b1be4a5cd75
arm64/mm: fold check for KFENCE into can_set_direct_map()

KFENCE requires linear map to be mapped at page granularity, so that it
is possible to protect/unprotect single pages, just like with
rodata_full and DEBUG_PAGEALLOC.

Instead of repating

can_set_direct_map() || IS_ENABLED(CONFIG_KFENCE)

make can_set_direct_map() handle the KFENCE case.

This also prevents potential false positives in kernel_page_present()
that may return true for non-present page if CONFIG_KFENCE is enabled.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/r/20220921074841.382615-1-rppt@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/mm/mmu.c
arch/arm64/mm/pageattr.c