linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: arm/crc32 - add kCFI annotations to asm routines
@ 2024-06-10 15:26 Ard Biesheuvel
  2024-06-10 16:45 ` Kees Cook
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2024-06-10 15:26 UTC (permalink / raw)
  To: linux-crypto
  Cc: linux-hardening, herbert, Ard Biesheuvel, Kees Cook,
	Linus Walleij

From: Ard Biesheuvel <ardb@kernel.org>

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 <keescook@chromium.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/arm/crypto/crc32-ce-core.S | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/arm/crypto/crc32-ce-core.S b/arch/arm/crypto/crc32-ce-core.S
index 3f13a76b9066..88f9edf94e95 100644
--- a/arch/arm/crypto/crc32-ce-core.S
+++ b/arch/arm/crypto/crc32-ce-core.S
@@ -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)
-- 
2.45.2.505.gda0bf45e8d-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: arm/crc32 - add kCFI annotations to asm routines
  2024-06-10 15:26 [PATCH] crypto: arm/crc32 - add kCFI annotations to asm routines Ard Biesheuvel
@ 2024-06-10 16:45 ` Kees Cook
  2024-06-11 21:10 ` Linus Walleij
  2024-06-21 12:31 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2024-06-10 16:45 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-crypto, linux-hardening, herbert, Ard Biesheuvel,
	Linus Walleij

On Mon, Jun 10, 2024 at 05:26:39PM +0200, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
> 
> 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 <keescook@chromium.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

Reviewed-by: Kees Cook <kees@kernel.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: arm/crc32 - add kCFI annotations to asm routines
  2024-06-10 15:26 [PATCH] crypto: arm/crc32 - add kCFI annotations to asm routines Ard Biesheuvel
  2024-06-10 16:45 ` Kees Cook
@ 2024-06-11 21:10 ` Linus Walleij
  2024-06-21 12:31 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2024-06-11 21:10 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-crypto, linux-hardening, herbert, Ard Biesheuvel, Kees Cook

On Mon, Jun 10, 2024 at 5:26 PM Ard Biesheuvel <ardb+git@google.com> wrote:

> From: Ard Biesheuvel <ardb@kernel.org>
>
> 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 <keescook@chromium.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

Fixes: 1a4fec49efe5 ("ARM: 9392/2: Support CLANG CFI")
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

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

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: arm/crc32 - add kCFI annotations to asm routines
  2024-06-10 15:26 [PATCH] crypto: arm/crc32 - add kCFI annotations to asm routines Ard Biesheuvel
  2024-06-10 16:45 ` Kees Cook
  2024-06-11 21:10 ` Linus Walleij
@ 2024-06-21 12:31 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2024-06-21 12:31 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-crypto, linux-hardening, Ard Biesheuvel, Kees Cook,
	Linus Walleij

On Mon, Jun 10, 2024 at 05:26:39PM +0200, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
> 
> 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 <keescook@chromium.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
>  arch/arm/crypto/crc32-ce-core.S | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-21 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-10 15:26 [PATCH] crypto: arm/crc32 - add kCFI annotations to asm routines Ard Biesheuvel
2024-06-10 16:45 ` Kees Cook
2024-06-11 21:10 ` Linus Walleij
2024-06-21 12:31 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).