2022-02-24 16:06:39

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH v2 10/39] x86/ibt,crypto: Add ENDBR for the jump-table entries


Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
---
arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 3 +++
1 file changed, 3 insertions(+)

--- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
+++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
@@ -195,6 +195,7 @@ SYM_FUNC_START(crc_pcl)
.altmacro
LABEL crc_ %i
.noaltmacro
+ ENDBR
crc32q -i*8(block_0), crc_init
crc32q -i*8(block_1), crc1
crc32q -i*8(block_2), crc2
@@ -203,6 +204,7 @@ LABEL crc_ %i

.altmacro
LABEL crc_ %i
+ ENDBR
.noaltmacro
crc32q -i*8(block_0), crc_init
crc32q -i*8(block_1), crc1
@@ -237,6 +239,7 @@ LABEL crc_ %i
################################################################

LABEL crc_ 0
+ ENDBR
mov tmp, len
cmp $128*24, tmp
jae full_block



2022-02-24 23:57:30

by Josh Poimboeuf

[permalink] [raw]
Subject: Re: [PATCH v2 10/39] x86/ibt,crypto: Add ENDBR for the jump-table entries

On Thu, Feb 24, 2022 at 03:51:48PM +0100, Peter Zijlstra wrote:
>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> ---
> arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 3 +++
> 1 file changed, 3 insertions(+)
>
> --- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
> +++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
> @@ -195,6 +195,7 @@ SYM_FUNC_START(crc_pcl)
> .altmacro
> LABEL crc_ %i
> .noaltmacro
> + ENDBR
> crc32q -i*8(block_0), crc_init
> crc32q -i*8(block_1), crc1
> crc32q -i*8(block_2), crc2
> @@ -203,6 +204,7 @@ LABEL crc_ %i
>
> .altmacro
> LABEL crc_ %i
> + ENDBR
> .noaltmacro

Minor inconsistency here in the placement of ENDBR. Should probably go
below .noaltmacro in both cases.

--
Josh

2022-02-25 08:53:55

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH v2 10/39] x86/ibt,crypto: Add ENDBR for the jump-table entries

On Thu, Feb 24, 2022 at 03:51:48PM +0100, Peter Zijlstra wrote:
>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>

Can you put some details in the commit log here about why these are
needed? My eyes can't find the indirect users...

> ---
> arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 3 +++
> 1 file changed, 3 insertions(+)
>
> --- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
> +++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
> @@ -195,6 +195,7 @@ SYM_FUNC_START(crc_pcl)
> .altmacro
> LABEL crc_ %i
> .noaltmacro
> + ENDBR
> crc32q -i*8(block_0), crc_init
> crc32q -i*8(block_1), crc1
> crc32q -i*8(block_2), crc2
> @@ -203,6 +204,7 @@ LABEL crc_ %i

--
Kees Cook

2022-02-25 14:15:31

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH v2 10/39] x86/ibt,crypto: Add ENDBR for the jump-table entries

On Thu, Feb 24, 2022 at 04:50:40PM -0800, Kees Cook wrote:
> On Thu, Feb 24, 2022 at 03:51:48PM +0100, Peter Zijlstra wrote:
> >
> > Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
>
> Can you put some details in the commit log here about why these are
> needed? My eyes can't find the indirect users...

## branch into array
mov jump_table(,%rax,8), %bufp
JMP_NOSPEC bufp

:-)