Skip to contentSkip to conversation

crypto: arm/crc32 - add kCFI annotations to asm routines

PATCH In review Ard Biesheuvel 4 participants 4 messages Jun 10, 2024 – Jun 21, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: arm/crc32 - add kCFI annotations to asm routines

From: Ard Biesheuvel <[email protected]>

The crc32/crc32c implementations using the scalar CRC32 instructions are accessed via indirect calls, and so they must be annotated with type ids in order to execute correctly when kCFI is enabled.

Cc Kees Cook <[email protected]>
Cc Linus Walleij <[email protected]>
---
 arch/arm/crypto/crc32-ce-core.S | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
arch/arm/crypto/crc32-ce-core.S +9 -8
index 3f13a76b9066..88f9edf94e95 100644
@@ -48,6 +48,7 @@
  */
 
 #include <linux/linkage.h>
+#include <linux/cfi_types.h>
 #include <asm/assembler.h>
 
 	.text
@@ -123,11 +124,12 @@
 	 * uint crc32_pmull_le(unsigned char const *buffer,
 	 *                     size_t len, uint crc32)
 	 */
-ENTRY(crc32_pmull_le)
+SYM_FUNC_START(crc32_pmull_le)
 	adr		r3, .Lcrc32_constants
 	b		0f
+SYM_FUNC_END(crc32_pmull_le)
 
-ENTRY(crc32c_pmull_le)
+SYM_FUNC_START(crc32c_pmull_le)
 	adr		r3, .Lcrc32c_constants
 
 0:	bic		LEN, LEN, #15
@@ -236,8 +238,7 @@ fold_64:
 	vmov		r0, s5
 
 	bx		lr
-ENDPROC(crc32_pmull_le)
-ENDPROC(crc32c_pmull_le)
+SYM_FUNC_END(crc32c_pmull_le)
 
 	.macro		__crc32, c
 	subs		ip, r2, #8
@@ -296,11 +297,11 @@ ARM_BE8(rev16		r3, r3		)
 	.endm
 
 	.align		5
-ENTRY(crc32_armv8_le)
+SYM_TYPED_FUNC_START(crc32_armv8_le)
 	__crc32
-ENDPROC(crc32_armv8_le)
+SYM_FUNC_END(crc32_armv8_le)
 
 	.align		5
-ENTRY(crc32c_armv8_le)
+SYM_TYPED_FUNC_START(crc32c_armv8_le)
 	__crc32		c
-ENDPROC(crc32c_armv8_le)
+SYM_FUNC_END(crc32c_armv8_le)
Signature · 1 line
2.45.2.505.gda0bf45e8d-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Ard Biesheuvel

From: Ard Biesheuvel <[email protected]>

The crc32/crc32c implementations using the scalar CRC32 instructions are accessed via indirect calls, and so they must be annotated with type ids in order to execute correctly when kCFI is enabled.

Cc Kees Cook <[email protected]>
Cc Linus Walleij <[email protected]>
Signature · 1 line
Kees Cook
Reviewed-by on v1 1/1
#2 lore raw
In reply to Ard Biesheuvel
Quoted 9 lines · Ard Biesheuvel

From: Ard Biesheuvel <[email protected]>

The crc32/crc32c implementations using the scalar CRC32 instructions are accessed via indirect calls, and so they must be annotated with type ids in order to execute correctly when kCFI is enabled.

Cc Kees Cook <[email protected]>
Cc Linus Walleij <[email protected]>
Fixes 1a4fec49efe5 ("ARM: 9392/2: Support CLANG CFI")

Thanks for helping to iron out the rough corners on these patches!

Yours,
Linus Walleij

maintainer
#3 lore raw
In reply to Ard Biesheuvel
Quoted 6 lines · Ard Biesheuvel

From: Ard Biesheuvel <[email protected]>

The crc32/crc32c implementations using the scalar CRC32 instructions are accessed via indirect calls, and so they must be annotated with type ids in order to execute correctly when kCFI is enabled.

Quoted 6 lines
Cc Kees Cook <[email protected]>
Cc Linus Walleij <[email protected]>
---
 arch/arm/crypto/crc32-ce-core.S | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt