Skip to content

Commit 5096732

Browse files
dwmw2KAGA-KOKO
authored andcommitted
x86/retpoline/checksum32: Convert assembler indirect jumps
Convert all indirect jumps in 32bit checksum assembler code to use non-speculative sequences when CONFIG_RETPOLINE is enabled. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Arjan van de Ven <arjan@linux.intel.com> Acked-by: Ingo Molnar <mingo@kernel.org> Cc: gnomes@lxorguk.ukuu.org.uk Cc: Rik van Riel <riel@redhat.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: thomas.lendacky@amd.com Cc: Peter Zijlstra <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Jiri Kosina <jikos@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Kees Cook <keescook@google.com> Cc: Tim Chen <tim.c.chen@linux.intel.com> Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org> Cc: Paul Turner <pjt@google.com> Link: https://lkml.kernel.org/r/1515707194-20531-11-git-send-email-dwmw@amazon.co.uk
1 parent ea08816 commit 5096732

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

arch/x86/lib/checksum_32.S

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
#include <asm/errno.h>
3030
#include <asm/asm.h>
3131
#include <asm/export.h>
32-
32+
#include <asm/nospec-branch.h>
33+
3334
/*
3435
* computes a partial checksum, e.g. for TCP/UDP fragments
3536
*/
@@ -156,7 +157,7 @@ ENTRY(csum_partial)
156157
negl %ebx
157158
lea 45f(%ebx,%ebx,2), %ebx
158159
testl %esi, %esi
159-
jmp *%ebx
160+
JMP_NOSPEC %ebx
160161

161162
# Handle 2-byte-aligned regions
162163
20: addw (%esi), %ax
@@ -439,7 +440,7 @@ ENTRY(csum_partial_copy_generic)
439440
andl $-32,%edx
440441
lea 3f(%ebx,%ebx), %ebx
441442
testl %esi, %esi
442-
jmp *%ebx
443+
JMP_NOSPEC %ebx
443444
1: addl $64,%esi
444445
addl $64,%edi
445446
SRC(movb -32(%edx),%bl) ; SRC(movb (%edx),%bl)

0 commit comments

Comments
 (0)