arm64: XN should only be set when the attribute MT_EXECUTE_NEVER is set

Only when SCTLR_ELn.WXN is set to 1, regions that are writable at ELn
are treated as non-executable. Therefore, when SCTLR_ELn.WXN is set to
0, regions that are writable at ELn can be executed, so the writable
attribute cannot be used to restrict the executable attribute.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
zhangyuan21 2023-10-12 19:14:22 +08:00 committed by Xiang Xiao
parent 0f56d3428b
commit abfeafa876
1 changed files with 1 additions and 1 deletions

View File

@ -336,7 +336,7 @@ static void set_pte_block_desc(uint64_t *pte, uint64_t addr_pa,
{
/* Make Normal RW memory as execute never */
if ((attrs & MT_RW) || (attrs & MT_EXECUTE_NEVER))
if (attrs & MT_EXECUTE_NEVER)
{
desc |= PTE_BLOCK_DESC_PXN;
}