Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 18 Aug 2018 02:36:25 -0000 Received: from userp2130.oracle.com ([156.151.31.86]) by Galois.linutronix.de with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fqr3m-00046C-Ev for speck@linutronix.de; Sat, 18 Aug 2018 04:33:51 +0200 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w7I2P8l8133741 for ; Sat, 18 Aug 2018 02:33:43 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2ksq7tt7b3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 18 Aug 2018 02:33:42 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w7I2XfeK011060 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 18 Aug 2018 02:33:41 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w7I2XfPu020443 for ; Sat, 18 Aug 2018 02:33:41 GMT Date: Fri, 17 Aug 2018 22:33:40 -0400 From: Konrad Rzeszutek Wilk Subject: [MODERATED] Re: Cache load gadgets Message-ID: <20180818023339.GB29487@char.us.oracle.com> References: <20180808145316.GX4238@tassilo.jf.intel.com> <20180808153429.quokqzwwvnripsdj@treble> <20180813151727.GA15539@char.us.oracle.com> <1534178427.2538.64.camel@infradead.org> <20180813192757.GA25361@agluck-desk> <74d17229-bb72-5d2b-7ea9-46402c0f0b07@alien8.de> <20180814150010.GB10097@tassilo.jf.intel.com> <8fbc0b4a-7c2a-e8bb-2da4-fc7ea67085b7@alien8.de> <101491ea-a194-6b07-9974-8bbbc50ca745@redhat.com> <4be96a4b-ee6f-fd51-21cb-f3c94d4ec39e@alien8.de> MIME-Version: 1.0 In-Reply-To: <4be96a4b-ee6f-fd51-21cb-f3c94d4ec39e@alien8.de> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Fri, Aug 17, 2018 at 10:00:13PM +0200, speck for Julian Stecklina wrote: > On 08/17/2018 11:18 AM, speck for Paolo Bonzini wrote: > > On 17/08/2018 11:11, speck for Julian Stecklina wrote: > >> L1TF in combination with a suitable cache load gadget on a HT-enabled > >> system is very practical. As we are not going to fix pure cache load > >> gadgets in the kernel, this leaves two options for the security minded: > >> a) Turn off HT and take a large performance hit for some workloads or b) > >> carry their own patches on top of upstream. > >> > >> I guess there are quite some people in the b) camp at the moment. > > KVM is special in that it has the EPT variant of L1TF, and fixing the > > most blatant cache load gadgets there is probably feasible. Doing it in > > general is hard and unmaintainable though. At least we should use > > sparse static analysis to track those tainted values. > > In general, I agree. For our usecase, we would also need to fix parts of > VFIO and maybe other common system call entry paths. It's just > labor-intense and error prone. > > The last days, I have been experimenting with making certain KVM memory > allocations process-local in the kernel, so they cannot be pulled in > with cache load gadgets from other processes in the first place. It > looks promising so far. Of course, this doesn't address the big linear > memory mapping of physical memory, but it's a start. Just in case you are not aware this was posted some time ago: https://marc.info/?l=linux-kernel&m=151923574116661&w=2 Any chance you could drop a git bundle of what you have done so far? > > I'm also hoping someone picks up the speculative load hardening compiler > pass in clang and fixes it for the kernel. Maybe the performance impact > is not so bad, if some hot code paths are manually checked. The problem > is mostly that they assume that RSP is positive, which is obviously not > the case in the kernel, but it looks fixable: > https://docs.google.com/document/d/1wwcfv3UV9ZnZVcGiGuoITT_61e_Ko3TmoCS3uXLcJR0/edit#heading=h.phdehs44eom6 > Let me ask the compiler folks in Oracle. > > Julian > >