diff mbox series

[v2,1/4] arm64: cpufeature: Account min_field_value when cheking secondaries for PAuth

Message ID 20220131170654.62381-2-vladimir.murzin@arm.com (mailing list archive)
State New, archived
Headers show
Series arm64: Support of PAuth QARMA3 architected algorithm | expand

Commit Message

Vladimir Murzin Jan. 31, 2022, 5:06 p.m. UTC
In case, both boot_val and sec_val have value below min_field_value we
would wrongly report that address authentication is supported. It is
not a big issue because we enable address authentication based on boot
cpu (and check there is correct).

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 arch/arm64/kernel/cpufeature.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Catalin Marinas Feb. 4, 2022, 6:13 p.m. UTC | #1
On Mon, Jan 31, 2022 at 05:06:51PM +0000, Vladimir Murzin wrote:
> In case, both boot_val and sec_val have value below min_field_value we
> would wrongly report that address authentication is supported. It is
> not a big issue because we enable address authentication based on boot
> cpu (and check there is correct).
> 
> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
diff mbox series

Patch

diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index a46ab3b..b0ec125 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1826,7 +1826,7 @@  static bool has_address_auth_cpucap(const struct arm64_cpu_capabilities *entry,
 	/* Now check for the secondary CPUs with SCOPE_LOCAL_CPU scope */
 	sec_val = cpuid_feature_extract_field(__read_sysreg_by_encoding(entry->sys_reg),
 					      entry->field_pos, entry->sign);
-	return sec_val == boot_val;
+	return (sec_val >= entry->min_field_value) && (sec_val == boot_val);
 }
 
 static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry,