Re: [PATCH v4 4/6] x86/bugs: Use ALTERNATIVE() instead of mds_user_clear static key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 27, 2023 at 07:38:59AM -0700, Pawan Gupta wrote:
> The VERW mitigation at exit-to-user is enabled via a static branch
> mds_user_clear. This static branch is never toggled after boot, and can
> be safely replaced with an ALTERNATIVE() which is convenient to use in
> asm.
> 
> Switch to ALTERNATIVE() to use the VERW mitigation late in exit-to-user
> path. Also remove the now redundant VERW in exc_nmi() and
> arch_exit_to_user_mode().
> 
> Signed-off-by: Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx>
> ---
>  Documentation/arch/x86/mds.rst       | 38 +++++++++++++++++++++++++-----------
>  arch/x86/include/asm/entry-common.h  |  1 -
>  arch/x86/include/asm/nospec-branch.h | 12 ------------
>  arch/x86/kernel/cpu/bugs.c           | 15 ++++++--------
>  arch/x86/kernel/nmi.c                |  2 --
>  arch/x86/kvm/vmx/vmx.c               |  2 +-
>  6 files changed, 34 insertions(+), 36 deletions(-)
> 
> diff --git a/Documentation/arch/x86/mds.rst b/Documentation/arch/x86/mds.rst
> index e73fdff62c0a..a5c5091b9ccd 100644
> --- a/Documentation/arch/x86/mds.rst
> +++ b/Documentation/arch/x86/mds.rst
> @@ -95,6 +95,9 @@ The kernel provides a function to invoke the buffer clearing:
>  
>      mds_clear_cpu_buffers()
>  
> +Also macro CLEAR_CPU_BUFFERS is meant to be used in ASM late in exit-to-user
> +path. This macro works for cases where GPRs can't be clobbered.

What does this last sentence mean?  Is it trying to say that the macro
doesn't clobber registers (other than ZF)?

-- 
Josh




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux