diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2021-09-01 09:50:22 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2021-09-01 09:50:22 +0000 |
commit | e49f1d0b9fe28e5d6c615146f2628754fa0ada71 (patch) | |
tree | c4697e13a68ba2f31a6c327173af870a18d77ae9 /sys/arch/amd64 | |
parent | 6738c2d19f88a6372e96d982149d05c57b97a55f (diff) |
Older AMD CPUs that do not support IBRS need an lfence after ret
to stop speculation. This seems to be necessary when the branch
predictor hits the ret for the first time. In their white paper
to mitigate speculation attacks, AMD's retpoline example has an
explicit lfence. Adjust our retpoline assembly macro in the kernel.
OK guenther@ mortimer@ deraadt@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/include/asm.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/arch/amd64/include/asm.h b/sys/arch/amd64/include/asm.h index 8097186ad04..fc575541d82 100644 --- a/sys/arch/amd64/include/asm.h +++ b/sys/arch/amd64/include/asm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asm.h,v 1.18 2019/04/02 03:35:08 mortimer Exp $ */ +/* $OpenBSD: asm.h,v 1.19 2021/09/01 09:50:21 bluhm Exp $ */ /* $NetBSD: asm.h,v 1.2 2003/05/02 18:05:47 yamt Exp $ */ /*- @@ -193,6 +193,7 @@ jmp 68b ; \ _ALIGN_TRAPS ; \ 69: mov %reg,(%rsp) ; \ - ret + ret ; \ + lfence #endif /* !_MACHINE_ASM_H_ */ |