From 7ca824a38c418fc3ee94583e32c8f0b2df3f6b1d Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Thu, 8 Apr 2021 12:08:18 +0200 Subject: [PATCH] ANDROID: arm64: simd: omit capability check in may_use_simd() may_use_simd() should only be called by code that may use FP/SIMD when it is available, and so checking whether the system supports FP/SIMD in the first place should be redundant - the caller in question (e.g., a SIMD crypto algorithm) should never be initialized in the first place. Checking the system capability involves jump labels and therefore code patching, which interferes with our ability to perform an integrity check on some of the crypto code. So let's get rid of the capability check altogether. Bug: 153614920 Bug: 188620248 Change-Id: Ia8df624f4648cc980a12a44eeb82e8f186d5f961 Signed-off-by: Ard Biesheuvel Signed-off-by: Eric Biggers --- arch/arm64/include/asm/simd.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/simd.h b/arch/arm64/include/asm/simd.h index 6a75d7ecdcaa..543fa59e72e0 100644 --- a/arch/arm64/include/asm/simd.h +++ b/arch/arm64/include/asm/simd.h @@ -35,9 +35,7 @@ static __must_check inline bool may_use_simd(void) * migrated, and if it's clear we cannot be migrated to a CPU * where it is set. */ - return !WARN_ON(!system_capabilities_finalized()) && - system_supports_fpsimd() && - !in_hardirq() && !irqs_disabled() && !in_nmi() && + return !in_hardirq() && !irqs_disabled() && !in_nmi() && !this_cpu_read(fpsimd_context_busy); }