Re: [PATCH] x86: guard against straight-line speculation past RET

2020-09-07 Thread Andrew Cooper
On 07/09/2020 10:25, Jan Beulich wrote: > On 04.09.2020 20:18, Andrew Cooper wrote: >> On 24/08/2020 13:50, Jan Beulich wrote: >>> --- a/xen/include/asm-x86/asm-defns.h >>> +++ b/xen/include/asm-x86/asm-defns.h >>> @@ -50,3 +50,19 @@ >>> .macro INDIRECT_JMP arg:req >>> INDIRECT_BRANCH jmp \ar

Re: [PATCH] x86: guard against straight-line speculation past RET

2020-09-07 Thread Jan Beulich
On 07.09.2020 15:50, Andrew Cooper wrote: > On 07/09/2020 10:25, Jan Beulich wrote: >> On 04.09.2020 20:18, Andrew Cooper wrote: >>> Third, there is a huge quantity of complexity for a form of the >>> instruction we don't use. >> The complexity isn't with handling the possible immediate operand, >>

Re: [PATCH] x86: guard against straight-line speculation past RET

2020-09-07 Thread Jan Beulich
On 07.09.2020 11:25, Jan Beulich wrote: > On 04.09.2020 20:18, Andrew Cooper wrote: >> Clang doesn't actually expand the macro for ret instructions, so a Clang >> build of Xen only ends up getting protected in the assembly files. >> >> The following experiment demonstrates the issue: >> >> $ cat re

Re: [PATCH] x86: guard against straight-line speculation past RET

2020-09-07 Thread Jan Beulich
On 04.09.2020 20:18, Andrew Cooper wrote: > On 24/08/2020 13:50, Jan Beulich wrote: >> --- a/xen/include/asm-x86/asm-defns.h >> +++ b/xen/include/asm-x86/asm-defns.h >> @@ -50,3 +50,19 @@ >> .macro INDIRECT_JMP arg:req >> INDIRECT_BRANCH jmp \arg >> .endm >> + >> +/* >> + * To guard against

Re: [PATCH] x86: guard against straight-line speculation past RET

2020-09-04 Thread Andrew Cooper
On 24/08/2020 13:50, Jan Beulich wrote: > --- a/xen/include/asm-x86/asm-defns.h > +++ b/xen/include/asm-x86/asm-defns.h > @@ -50,3 +50,19 @@ > .macro INDIRECT_JMP arg:req > INDIRECT_BRANCH jmp \arg > .endm > + > +/* > + * To guard against speculation past RET, insert a breakpoint insn > + *

[PATCH] x86: guard against straight-line speculation past RET

2020-08-24 Thread Jan Beulich
Under certain conditions CPUs can speculate into the instruction stream past a RET instruction. Guard against this just like 3b7dab93f240 ("x86/spec-ctrl: Protect against CALL/JMP straight-line speculation") did - by inserting an "INT $3" insn. It's merely the mechanics of how to achieve this that