*If* the C code is compiled with endbr support, put one at the assembly
system call entry point as well.

Note that no endbr is required at the sigreturn entry points, because
those are logically subroutine returns and invoked via ret
instructions.

Signed-off-by: H. Peter Anvin (Intel) <[email protected]>
---
 arch/x86/entry/vdso/vdso32/system_call.S | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/entry/vdso/vdso32/system_call.S 
b/arch/x86/entry/vdso/vdso32/system_call.S
index d14eca4403c5..0ca7ca1c490b 100644
--- a/arch/x86/entry/vdso/vdso32/system_call.S
+++ b/arch/x86/entry/vdso/vdso32/system_call.S
@@ -8,12 +8,19 @@
 #include <asm/cpufeatures.h>
 #include <asm/alternative.h>
 
+.macro CET_ENDBR
+#if defined(__CET__) && (__CET__ & 1)
+       endbr32
+#endif
+.endm
+
        .text
        .globl __kernel_vsyscall
        .type __kernel_vsyscall,@function
        ALIGN
 __kernel_vsyscall:
        CFI_STARTPROC
+       CET_ENDBR
        /*
         * Reshuffle regs so that all of any of the entry instructions
         * will preserve enough state.
-- 
2.51.1


Reply via email to