[PATCH v2 2/4] arm64/process: Make loading of 32bit processes depend on aarch32_enabled()

From: Andrea della Porta
Date: Mon Oct 23 2023 - 10:44:09 EST


Major aspect of Aarch32 support is the ability to load 32bit
processes.
That's currently decided (among others) by compat_elf_check_arch()
and system_supports_32bit_el0().

Make the macro use aarch32_enabled() to decide if Aarch32 compat is
enabled before loading a 32bit process.

Signed-off-by: Andrea della Porta <andrea.porta@xxxxxxxx>
---
arch/arm64/include/asm/cpufeature.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index 1180d68daaff..778f2f3b2c7d 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -679,8 +679,9 @@ static inline bool system_supports_32bit_el0(void)
{
u64 pfr0 = read_sanitised_ftr_reg(SYS_ID_AA64PFR0_EL1);

- return static_branch_unlikely(&arm64_mismatched_32bit_el0) ||
- id_aa64pfr0_32bit_el0(pfr0);
+ return (static_branch_unlikely(&arm64_mismatched_32bit_el0) ||
+ id_aa64pfr0_32bit_el0(pfr0)) &&
+ aarch32_enabled();
}

static inline bool system_supports_4kb_granule(void)
--
2.35.3