Re: [PATCH v3 2/6] x86/entry_64: Add VERW just before userspace transition

From: Dave Hansen
Date: Thu Oct 26 2023 - 18:17:56 EST


On 10/26/23 15:13, Pawan Gupta wrote:
>>>> Interrupts returning to kernel don't clear the CPU buffers. I believe
>>>> interrupts will be enabled here, and getting an interrupt here could
>>>> leak the data that interrupt touched.
>>> Specifically NMIs, right?
>> Yes, and VERW can omitted for the same reason as NMI returning to
>> kernel.
> Thinking more on this, we should not omit verw here, as this spot is way
> easier to target NMIs. A user executing SYSENTER in a loop has much
> higher chances of causing an NMI to return to kernel, and skip verw.

Right.

This is also a path where we care *ZERO* about performance. It's
basically all upside to _add_ VERW and all downside (increased attack
surface) to skip it.