public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Alexandre Chartre <alexandre.chartre@oracle.com>
Cc: bp@alien8.de, x86@kernel.org, linux-kernel@vger.kernel.org,
	konrad.wilk@oracle.com, boris.ostrovsky@oracle.com,
	ankur.a.arora@oracle.com, maciej.szmigiero@oracle.com
Subject: Re: [PATCH] x86/entry: Remove UNTRAIN_RET from native_irq_return_ldt
Date: Thu, 14 Jul 2022 11:41:46 +0200	[thread overview]
Message-ID: <Ys/k2gPLanPoF+ML@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220713195808.452394-1-alexandre.chartre@oracle.com>

On Wed, Jul 13, 2022 at 09:58:08PM +0200, Alexandre Chartre wrote:
> UNTRAIN_RET is not needed in native_irq_return_ldt because ret untrain
> has already be done at this point. In addition, when the RETBleed
> mitigation is IBPB, UNTRAIN_RET clobbers several registers (AX, CX, DX)
> so here it trashes user values which are in these registers.
> 
> Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

> ---
>  arch/x86/entry/entry_64.S | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index 285e043a3e40..9953d966d124 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -727,7 +727,6 @@ native_irq_return_ldt:
>  	pushq	%rdi				/* Stash user RDI */
>  	swapgs					/* to kernel GS */
>  	SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi	/* to kernel CR3 */
> -	UNTRAIN_RET
>  
>  	movq	PER_CPU_VAR(espfix_waddr), %rdi
>  	movq	%rax, (0*8)(%rdi)		/* user RAX */
> -- 
> 2.31.1
> 

      reply	other threads:[~2022-07-14  9:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 19:58 [PATCH] x86/entry: Remove UNTRAIN_RET from native_irq_return_ldt Alexandre Chartre
2022-07-14  9:41 ` Peter Zijlstra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ys/k2gPLanPoF+ML@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=alexandre.chartre@oracle.com \
    --cc=ankur.a.arora@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.szmigiero@oracle.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox