* [PATCH] lib/crypto: x86/sha512: Drop unnecessary ANNOTATE_NOENDBR
@ 2025-06-27 19:09 Eric Biggers
2025-07-08 1:39 ` Ard Biesheuvel
0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2025-06-27 19:09 UTC (permalink / raw)
To: linux-crypto
Cc: x86, linux-kernel, Ard Biesheuvel, Jason A . Donenfeld,
Eric Biggers
When migrating the x86 SHA-512 assembly code to lib/crypto/, I replaced
SYM_TYPED_FUNC_START with ANNOTATE_NOENDBR. This was intended to match
a change in the caller from an indirect call to a static call, like what
I did for SHA-256. However, for SHA-512 I actually decided to bring the
static call up a level; see DEFINE_X86_SHA512_FN in
lib/crypto/x86/sha512.h. Therefore, now the assembly functions are just
called via normal direct calls. At least for SHA this seems to be the
better way to do it, and it means using ANNOTATE_NOENDBR is unnecessary.
Fixes: b82535bf96da ("lib/crypto: x86/sha512: Migrate optimized SHA-512 code to library")
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
This patch is targeting libcrypto-next.
lib/crypto/x86/sha512-avx-asm.S | 2 --
lib/crypto/x86/sha512-avx2-asm.S | 2 --
lib/crypto/x86/sha512-ssse3-asm.S | 2 --
3 files changed, 6 deletions(-)
diff --git a/lib/crypto/x86/sha512-avx-asm.S b/lib/crypto/x86/sha512-avx-asm.S
index af7ea311cc945..7732aa8fd8506 100644
--- a/lib/crypto/x86/sha512-avx-asm.S
+++ b/lib/crypto/x86/sha512-avx-asm.S
@@ -46,11 +46,10 @@
# and search for that title.
#
########################################################################
#include <linux/linkage.h>
-#include <linux/objtool.h>
.text
# Virtual Registers
# ARG1
@@ -274,11 +273,10 @@ frame_size = frame_WK + WK_SIZE
# The size of the message pointed to by "data" must be an integer multiple
# of SHA512 message blocks.
# "nblocks" is the message length in SHA512 blocks. Must be >= 1.
########################################################################
SYM_FUNC_START(sha512_transform_avx)
- ANNOTATE_NOENDBR # since this is called only via static_call
# Save GPRs
push %rbx
push %r12
push %r13
diff --git a/lib/crypto/x86/sha512-avx2-asm.S b/lib/crypto/x86/sha512-avx2-asm.S
index 1302ddb5ec8cc..22bdbfd899d0f 100644
--- a/lib/crypto/x86/sha512-avx2-asm.S
+++ b/lib/crypto/x86/sha512-avx2-asm.S
@@ -48,11 +48,10 @@
########################################################################
# This code schedules 1 blocks at a time, with 4 lanes per block
########################################################################
#include <linux/linkage.h>
-#include <linux/objtool.h>
.text
# Virtual Registers
Y_0 = %ymm4
@@ -566,11 +565,10 @@ frame_size = frame_CTX + CTX_SIZE
# The size of the message pointed to by "data" must be an integer multiple
# of SHA512 message blocks.
# "nblocks" is the message length in SHA512 blocks. Must be >= 1.
########################################################################
SYM_FUNC_START(sha512_transform_rorx)
- ANNOTATE_NOENDBR # since this is called only via static_call
# Save GPRs
push %rbx
push %r12
push %r13
diff --git a/lib/crypto/x86/sha512-ssse3-asm.S b/lib/crypto/x86/sha512-ssse3-asm.S
index 108f1accc6bc7..4cae7445b2a86 100644
--- a/lib/crypto/x86/sha512-ssse3-asm.S
+++ b/lib/crypto/x86/sha512-ssse3-asm.S
@@ -46,11 +46,10 @@
# and search for that title.
#
########################################################################
#include <linux/linkage.h>
-#include <linux/objtool.h>
.text
# Virtual Registers
# ARG1
@@ -273,11 +272,10 @@ frame_size = frame_WK + WK_SIZE
# The size of the message pointed to by "data" must be an integer multiple
# of SHA512 message blocks.
# "nblocks" is the message length in SHA512 blocks. Must be >= 1.
########################################################################
SYM_FUNC_START(sha512_transform_ssse3)
- ANNOTATE_NOENDBR # since this is called only via static_call
# Save GPRs
push %rbx
push %r12
push %r13
base-commit: d74152ec2b5106263c2a502380acfaf5954f9898
--
2.50.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] lib/crypto: x86/sha512: Drop unnecessary ANNOTATE_NOENDBR
2025-06-27 19:09 [PATCH] lib/crypto: x86/sha512: Drop unnecessary ANNOTATE_NOENDBR Eric Biggers
@ 2025-07-08 1:39 ` Ard Biesheuvel
0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2025-07-08 1:39 UTC (permalink / raw)
To: Eric Biggers; +Cc: linux-crypto, x86, linux-kernel, Jason A . Donenfeld
On Sat, 28 Jun 2025 at 05:11, Eric Biggers <ebiggers@kernel.org> wrote:
>
> When migrating the x86 SHA-512 assembly code to lib/crypto/, I replaced
> SYM_TYPED_FUNC_START with ANNOTATE_NOENDBR. This was intended to match
> a change in the caller from an indirect call to a static call, like what
> I did for SHA-256. However, for SHA-512 I actually decided to bring the
> static call up a level; see DEFINE_X86_SHA512_FN in
> lib/crypto/x86/sha512.h. Therefore, now the assembly functions are just
> called via normal direct calls. At least for SHA this seems to be the
> better way to do it, and it means using ANNOTATE_NOENDBR is unnecessary.
>
> Fixes: b82535bf96da ("lib/crypto: x86/sha512: Migrate optimized SHA-512 code to library")
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
>
> This patch is targeting libcrypto-next.
>
> lib/crypto/x86/sha512-avx-asm.S | 2 --
> lib/crypto/x86/sha512-avx2-asm.S | 2 --
> lib/crypto/x86/sha512-ssse3-asm.S | 2 --
> 3 files changed, 6 deletions(-)
>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
> diff --git a/lib/crypto/x86/sha512-avx-asm.S b/lib/crypto/x86/sha512-avx-asm.S
> index af7ea311cc945..7732aa8fd8506 100644
> --- a/lib/crypto/x86/sha512-avx-asm.S
> +++ b/lib/crypto/x86/sha512-avx-asm.S
> @@ -46,11 +46,10 @@
> # and search for that title.
> #
> ########################################################################
>
> #include <linux/linkage.h>
> -#include <linux/objtool.h>
>
> .text
>
> # Virtual Registers
> # ARG1
> @@ -274,11 +273,10 @@ frame_size = frame_WK + WK_SIZE
> # The size of the message pointed to by "data" must be an integer multiple
> # of SHA512 message blocks.
> # "nblocks" is the message length in SHA512 blocks. Must be >= 1.
> ########################################################################
> SYM_FUNC_START(sha512_transform_avx)
> - ANNOTATE_NOENDBR # since this is called only via static_call
>
> # Save GPRs
> push %rbx
> push %r12
> push %r13
> diff --git a/lib/crypto/x86/sha512-avx2-asm.S b/lib/crypto/x86/sha512-avx2-asm.S
> index 1302ddb5ec8cc..22bdbfd899d0f 100644
> --- a/lib/crypto/x86/sha512-avx2-asm.S
> +++ b/lib/crypto/x86/sha512-avx2-asm.S
> @@ -48,11 +48,10 @@
> ########################################################################
> # This code schedules 1 blocks at a time, with 4 lanes per block
> ########################################################################
>
> #include <linux/linkage.h>
> -#include <linux/objtool.h>
>
> .text
>
> # Virtual Registers
> Y_0 = %ymm4
> @@ -566,11 +565,10 @@ frame_size = frame_CTX + CTX_SIZE
> # The size of the message pointed to by "data" must be an integer multiple
> # of SHA512 message blocks.
> # "nblocks" is the message length in SHA512 blocks. Must be >= 1.
> ########################################################################
> SYM_FUNC_START(sha512_transform_rorx)
> - ANNOTATE_NOENDBR # since this is called only via static_call
>
> # Save GPRs
> push %rbx
> push %r12
> push %r13
> diff --git a/lib/crypto/x86/sha512-ssse3-asm.S b/lib/crypto/x86/sha512-ssse3-asm.S
> index 108f1accc6bc7..4cae7445b2a86 100644
> --- a/lib/crypto/x86/sha512-ssse3-asm.S
> +++ b/lib/crypto/x86/sha512-ssse3-asm.S
> @@ -46,11 +46,10 @@
> # and search for that title.
> #
> ########################################################################
>
> #include <linux/linkage.h>
> -#include <linux/objtool.h>
>
> .text
>
> # Virtual Registers
> # ARG1
> @@ -273,11 +272,10 @@ frame_size = frame_WK + WK_SIZE
> # The size of the message pointed to by "data" must be an integer multiple
> # of SHA512 message blocks.
> # "nblocks" is the message length in SHA512 blocks. Must be >= 1.
> ########################################################################
> SYM_FUNC_START(sha512_transform_ssse3)
> - ANNOTATE_NOENDBR # since this is called only via static_call
>
> # Save GPRs
> push %rbx
> push %r12
> push %r13
>
> base-commit: d74152ec2b5106263c2a502380acfaf5954f9898
> --
> 2.50.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-08 1:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 19:09 [PATCH] lib/crypto: x86/sha512: Drop unnecessary ANNOTATE_NOENDBR Eric Biggers
2025-07-08 1:39 ` Ard Biesheuvel
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).