diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2018-06-07 04:09:36 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2018-06-07 04:09:36 +0000 |
commit | 9655df454913240f7db9808731598fbeee4928ac (patch) | |
tree | 0296ac5b42234a58d35fa5cce4b4b5e9e51859b0 /sys/arch/amd64/include | |
parent | 82ffc78b48d0a7ef32d4ec5e81f7153b568efe70 (diff) |
Apply the retpoline transformation to indirect jumps in the raw ASM
ok mlarkin@ mortimer@ deraadt@
Diffstat (limited to 'sys/arch/amd64/include')
-rw-r--r-- | sys/arch/amd64/include/asm.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/arch/amd64/include/asm.h b/sys/arch/amd64/include/asm.h index cd3922b4b26..f3b7a249534 100644 --- a/sys/arch/amd64/include/asm.h +++ b/sys/arch/amd64/include/asm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asm.h,v 1.9 2018/02/21 19:24:15 guenther Exp $ */ +/* $OpenBSD: asm.h,v 1.10 2018/06/07 04:09:35 guenther Exp $ */ /* $NetBSD: asm.h,v 1.2 2003/05/02 18:05:47 yamt Exp $ */ /*- @@ -120,4 +120,13 @@ .stabs __STRING(sym),1,0,0,0 #endif /* __STDC__ */ +/* generic retpoline ("return trampoline") generator */ +#define JMP_RETPOLINE(reg) \ + call 69f ; \ + 68: pause ; \ + jmp 68b ; \ + .align 16,0xcc ; \ + 69: mov %reg,(%rsp) ; \ + ret + #endif /* !_MACHINE_ASM_H_ */ |