From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
To: Brian Gerst <brgerst@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
linux-kernel@vger.kernel.org, x86@kernel.org,
Robert Gill <rtgill82@gmail.com>,
Jari Ruusu <jariruusu@protonmail.com>,
"Linux regression tracking (Thorsten Leemhuis)"
<regressions@leemhuis.info>,
antonio.gomez.iglesias@linux.intel.com,
daniel.sneddon@linux.intel.com
Subject: Re: [PATCH v3] x86/entry_32: Move CLEAR_CPU_BUFFERS before restoring segments
Date: Mon, 1 Jul 2024 16:22:21 -0700 [thread overview]
Message-ID: <20240701232221.s4egkkyctgrasulr@desk> (raw)
In-Reply-To: <CAMzpN2iJHO01499VsarF1a3ZyjCLUn36FpNqEZeAaXuCoc9GwA@mail.gmail.com>
On Mon, Jul 01, 2024 at 03:22:44PM -0400, Brian Gerst wrote:
> Perhaps I should have been a bit clearer, but I meant adding the SS
> override to the VERW instructions in their present locations, instead
> of moving it into RESTORE_REGS.
I did consider that way, but moving it to RESTORE_REGS saves a callsite for
CLEAR_CPU_BUFFERS. I believe Dave prefered it within RESTORE_REGS, but that
was before the SS override. Unless anyone has a strong preference, I will
change the current callsites to include the SS override, and not move
CLEAR_CPU_BUFFERS to RESTORE_REGS.
> IIRC we don't want data reads (including stack pops) between the VERW
> instruction and IRET/SYSEXIT.
Stack pops are okay if the memory *and* the registers doesn't contain
sensitive data, which doesn't seem to be the case here. But, SS override is
a safer option.
BTW, Dave pointed out that CLEAR_CPU_BUFFERS needs to be done after
RESTORE_ALL_NMI in the NMI return path, that adds an extra callsite:
---
diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index d3a814efbff6..9b58d2cbdfef 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -1144,7 +1144,6 @@ SYM_CODE_START(asm_exc_nmi)
/* Not on SYSENTER stack. */
call exc_nmi
- CLEAR_CPU_BUFFERS
jmp .Lnmi_return
.Lnmi_from_sysenter_stack:
@@ -1165,6 +1164,7 @@ SYM_CODE_START(asm_exc_nmi)
CHECK_AND_APPLY_ESPFIX
RESTORE_ALL_NMI cr3_reg=%edi pop=4
+ CLEAR_CPU_BUFFERS
jmp .Lirq_return
#ifdef CONFIG_X86_ESPFIX32
@@ -1206,6 +1206,7 @@ SYM_CODE_START(asm_exc_nmi)
* 1 - orig_ax
*/
lss (1+5+6)*4(%esp), %esp # back to espfix stack
+ CLEAR_CPU_BUFFERS
jmp .Lirq_return
#endif
SYM_CODE_END(asm_exc_nmi)
prev parent reply other threads:[~2024-07-01 23:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 18:34 Pawan Gupta
2024-07-01 19:22 ` Brian Gerst
2024-07-01 23:22 ` Pawan Gupta [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=20240701232221.s4egkkyctgrasulr@desk \
--to=pawan.kumar.gupta@linux.intel.com \
--cc=antonio.gomez.iglesias@linux.intel.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=daniel.sneddon@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=jariruusu@protonmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=regressions@leemhuis.info \
--cc=rtgill82@gmail.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
all inboxes | Powered by JetHome®