Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 19 Feb 2019 16:17:54 -0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by Galois.linutronix.de with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gw85g-0001h8-Qs for speck@linutronix.de; Tue, 19 Feb 2019 17:17:53 +0100 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gw85f-0008Eh-3f for speck@linutronix.de; Tue, 19 Feb 2019 16:17:51 +0000 Date: Tue, 19 Feb 2019 17:17:49 +0100 From: Peter Zijlstra Subject: [MODERATED] Re: [patch 4/8] MDS basics 4 Message-ID: <20190219161749.GB32494@hirez.programming.kicks-ass.net> References: <20190219124406.449727187@linutronix.de> <20190219125346.141295571@linutronix.de> <7f92c34c-a3c4-1df2-c026-c7309c6ff3f2@citrix.com> <20190219160913.GU16922@tassilo.jf.intel.com> MIME-Version: 1.0 In-Reply-To: <20190219160913.GU16922@tassilo.jf.intel.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Tue, Feb 19, 2019 at 08:09:13AM -0800, speck for Andi Kleen wrote: > On Tue, Feb 19, 2019 at 03:07:59PM +0100, speck for Thomas Gleixner wrote: > > On Tue, 19 Feb 2019, speck for Thomas Gleixner wrote: > > > On Tue, 19 Feb 2019, speck for Andrew Cooper wrote: > > > > > > > On 19/02/2019 12:44, speck for Thomas Gleixner wrote: > > > > > Subject: [patch 4/8] x86/speculation/mds: Conditionaly clear CPU buffers on idle entry > > > > > From: Thomas Gleixner > > > > > > > > > > Add a static key which controls the invocation of the CPU buffer clear > > > > > mechanism on idle entry. This is independent of other MDS mitigations > > > > > because the idle entry invocation to mitigate the potential leakage due to > > > > > store buffer repartitioning is only necessary on SMT systems. > > > > > > > > > > Add the actual invocations to the different halt/mwait variants which > > > > > covers all usage sites. mwaitx is not patched as it's not available on > > > > > Intel CPUs. > > > > > > > > > > Signed-off-by: Thomas Gleixner > > > > > > > > Unfortunately, clearing is needed on the exit from idle as well as the > > > > entry. > > > > > > > > This only impacts the store buffer (MSBDS, previously PSF) because it > > > > gets statically re-partitioned when a thread comes in and out of idle. > > > > > > > > >From the point of view of the thread going idle, when going idle my half > > > > of the store buffers get given to the other thread and potentially leak > > > > my secrets, whereas when coming out of idle, the other threads store > > > > buffers get split with me, potentially leaking their secrets. > > > > > > Duh, indeed. Easy enough to fix. > > > > Delta patch below. Stupid me even mentioned the repartioning on both sides > > in the changelog. > > It's not needed. But will the part of the store buffer that gets repartitioned not contain state of the other sibling? If it can see our data after we go idle; why can't we see its data when we come out of idle?