From: Dave Hansen <dave.hansen@intel.com>
To: "Shah, Amit" <Amit.Shah@amd.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>
Cc: "corbet@lwn.net" <corbet@lwn.net>,
"boris.ostrovsky@oracle.com" <boris.ostrovsky@oracle.com>,
"kai.huang@intel.com" <kai.huang@intel.com>,
"pawan.kumar.gupta@linux.intel.com"
<pawan.kumar.gupta@linux.intel.com>,
"jpoimboe@kernel.org" <jpoimboe@kernel.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"daniel.sneddon@linux.intel.com" <daniel.sneddon@linux.intel.com>,
"Lendacky, Thomas" <Thomas.Lendacky@amd.com>,
"seanjc@google.com" <seanjc@google.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"Moger, Babu" <Babu.Moger@amd.com>,
"Das1, Sandipan" <Sandipan.Das@amd.com>,
"hpa@zytor.com" <hpa@zytor.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"bp@alien8.de" <bp@alien8.de>,
"Kaplan, David" <David.Kaplan@amd.com>
Subject: Re: [PATCH 1/2] x86: cpu/bugs: add support for AMD ERAPS feature
Date: Tue, 5 Nov 2024 08:19:31 -0800 [thread overview]
Message-ID: <a296a079-fec6-42d7-82fe-b1b7e9004230@intel.com> (raw)
In-Reply-To: <975a74f19f9c8788e5abe99d37ca2b7697b55a23.camel@amd.com>
On 11/5/24 02:39, Shah, Amit wrote:
> On Mon, 2024-11-04 at 09:45 -0800, Dave Hansen wrote:
> I'm expecting the APM update come out soon, but I have put together
>
> https://amitshah.net/2024/11/eraps-reduces-software-tax-for-hardware-bugs/
>
> based on information I have. I think it's mostly consistent with what
> I've said so far - with the exception of the mov-CR3 flush only
> confirmed yesterday.
That's better. But your original cover letter did say:
Feature documented in AMD PPR 57238.
which is technically true because the _bit_ is defined. But it's far,
far from being sufficiently documented for Linux to actually use it.
Could we please be more careful about these in the future?
>> So, I'll flip this back around. Today, X86_FEATURE_RSB_CTXSW zaps
>> the
>> RSB whenever RSP is updated to a new task stack. Please convince me
>> that ERAPS provides superior coverage or is unnecessary in all the
>> possible combinations switching between:
>>
>> different thread, same mm
>
> This case is the same userspace process with valid addresses in the RSB
> for that process. An invalid speculation isn't security sensitive,
> just a misprediction that won't be retired. So we are good here.
Does that match what the __switch_to_asm comment says, though?
> /*
> * When switching from a shallower to a deeper call stack
> * the RSB may either underflow or use entries populated
> * with userspace addresses. On CPUs where those concerns
> * exist, overwrite the RSB with entries which capture
> * speculative execution to prevent attack.
> */
It is also talking just about call depth, not about same-address-space
RSB entries being harmless. That's because this is also trying to avoid
having the kernel consume any user-placed RSB entries, regardless of
whether they're from the same mm or not.
>> user=>kernel, same mm
>> kernel=>user, same mm
>
> user-kernel is protected with SMEP. Also, we don't call
> FILL_RETURN_BUFFER for these switches?
Amit, I'm beginning to fear that you haven't gone and looked at the
relevant code here. Please go look at SYM_FUNC_START(__switch_to_asm)
in arch/x86/entry/entry_64.S. I believe this code is called for all
task switches, including switching from a user task to a kernel task. I
also believe that FILL_RETURN_BUFFER is used unconditionally for every
__switch_to_asm call (when X86_FEATURE_RSB_CTXSW is on of course).
Could we please start over on this patch?
Let's get the ERAPS+TLB-flush nonsense out of the kernel and get the
commit message right.
Then let's go from there.
next prev parent reply other threads:[~2024-11-05 16:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 15:39 [PATCH 0/2] Add support for the ERAPS feature Amit Shah
2024-10-31 15:39 ` [PATCH 1/2] x86: cpu/bugs: add support for AMD " Amit Shah
2024-10-31 23:03 ` Pawan Gupta
2024-11-04 8:57 ` Shah, Amit
2024-11-04 14:52 ` Andrew Cooper
2024-11-04 15:00 ` Shah, Amit
2024-10-31 23:11 ` Dave Hansen
2024-11-04 8:58 ` Shah, Amit
2024-11-04 16:11 ` Dave Hansen
2024-11-04 16:13 ` Shah, Amit
2024-11-04 16:26 ` Dave Hansen
2024-11-04 17:22 ` Shah, Amit
2024-11-04 17:45 ` Dave Hansen
2024-11-05 0:04 ` Andrew Cooper
2024-11-05 10:39 ` Shah, Amit
2024-11-05 14:54 ` Kaplan, David
2024-11-05 16:19 ` Dave Hansen [this message]
2024-11-05 16:25 ` Shah, Amit
2024-10-31 15:39 ` [PATCH 2/2] x86: kvm: svm: add support for ERAPS and FLUSH_RAP_ON_VMRUN Amit Shah
2024-10-31 23:13 ` Pawan Gupta
2024-11-01 4:14 ` kernel test robot
2024-11-01 9:26 ` Amit Shah
2024-11-04 5:18 ` Borislav Petkov
2024-11-04 11:16 ` Shah, Amit
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=a296a079-fec6-42d7-82fe-b1b7e9004230@intel.com \
--to=dave.hansen@intel.com \
--cc=Amit.Shah@amd.com \
--cc=Babu.Moger@amd.com \
--cc=David.Kaplan@amd.com \
--cc=Sandipan.Das@amd.com \
--cc=Thomas.Lendacky@amd.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=daniel.sneddon@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@kernel.org \
--cc=kai.huang@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--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