Re: [PATCH 2/3] x86/sev-es: Check if regs->sp is trusted before adjusting #VC IST stack

2021-02-19 Thread Joerg Roedel
On Thu, Feb 18, 2021 at 04:28:36PM -0800, Andy Lutomirski wrote: > On Thu, Feb 18, 2021 at 11:21 AM Joerg Roedel wrote: > Can you give me an example, even artificial, in which the linked-list > logic is useful? So here we go, its of course artificial, but still: 1. #VC happens, not impor

Re: [PATCH 2/3] x86/sev-es: Check if regs->sp is trusted before adjusting #VC IST stack

2021-02-18 Thread Andy Lutomirski
On Thu, Feb 18, 2021 at 11:21 AM Joerg Roedel wrote: > > On Thu, Feb 18, 2021 at 09:49:06AM -0800, Andy Lutomirski wrote: > > I don't understand what this means. The whole entry mechanism on x86 > > is structured so that we call a C function *and return from that C > > function without longjmp-li

Re: [PATCH 2/3] x86/sev-es: Check if regs->sp is trusted before adjusting #VC IST stack

2021-02-18 Thread Joerg Roedel
On Thu, Feb 18, 2021 at 09:49:06AM -0800, Andy Lutomirski wrote: > I don't understand what this means. The whole entry mechanism on x86 > is structured so that we call a C function *and return from that C > function without longjmp-like magic* with the sole exception of > unwind_stack_do_exit().

Re: [PATCH 2/3] x86/sev-es: Check if regs->sp is trusted before adjusting #VC IST stack

2021-02-18 Thread Andy Lutomirski
On Thu, Feb 18, 2021 at 3:25 AM Joerg Roedel wrote: > > Hi Andy, > > On Wed, Feb 17, 2021 at 10:09:46AM -0800, Andy Lutomirski wrote: > > Can you get rid of the linked list hack while you're at it? This code > > is unnecessarily convoluted right now, and it seems to be just asking > > for weird b

Re: [PATCH 2/3] x86/sev-es: Check if regs->sp is trusted before adjusting #VC IST stack

2021-02-18 Thread Joerg Roedel
Hi Andy, On Wed, Feb 17, 2021 at 10:09:46AM -0800, Andy Lutomirski wrote: > Can you get rid of the linked list hack while you're at it? This code > is unnecessarily convoluted right now, and it seems to be just asking > for weird bugs. Just stash the old value in a local variable, please. Yeah,

Re: [PATCH 2/3] x86/sev-es: Check if regs->sp is trusted before adjusting #VC IST stack

2021-02-17 Thread Andy Lutomirski
On Wed, Feb 17, 2021 at 4:02 AM Joerg Roedel wrote: > > From: Joerg Roedel > > The code in the NMI handler to adjust the #VC handler IST stack is > needed in case an NMI hits when the #VC handler is still using its IST > stack. > But the check for this condition also needs to look if the regs->sp

Re: [PATCH 2/3] x86/sev-es: Check if regs->sp is trusted before adjusting #VC IST stack

2021-02-17 Thread Borislav Petkov
On Wed, Feb 17, 2021 at 01:01:42PM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > The code in the NMI handler to adjust the #VC handler IST stack is > needed in case an NMI hits when the #VC handler is still using its IST > stack. > But the check for this condition also needs to look if the

[PATCH 2/3] x86/sev-es: Check if regs->sp is trusted before adjusting #VC IST stack

2021-02-17 Thread Joerg Roedel
From: Joerg Roedel The code in the NMI handler to adjust the #VC handler IST stack is needed in case an NMI hits when the #VC handler is still using its IST stack. But the check for this condition also needs to look if the regs->sp value is trusted, meaning it was not set by user-space. Extend th