Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 25 Jun 2018 20:32:18 -0000 Received: from mga11.intel.com ([192.55.52.93]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fXY9o-0005p3-Cg for speck@linutronix.de; Mon, 25 Jun 2018 22:32:17 +0200 Date: Mon, 25 Jun 2018 13:31:54 -0700 From: Andi Kleen Subject: [MODERATED] Re: [PATCH 8/8] L1TFv8 6 Message-ID: <20180625203154.GB19456@tassilo.jf.intel.com> References: <20180614150632.E064C61183@crypto-ml.lab.linutronix.de> <4ad5c4d2-7721-729e-3af6-6c8ed84dda9f@suse.cz> <260fce1e-c5fe-cace-56a8-a83c2a41f115@suse.cz> <20180622165652.GX30690@tassilo.jf.intel.com> MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Mon, Jun 25, 2018 at 09:04:34AM +0200, speck for Vlastimil Babka wrote: > On 06/22/2018 06:56 PM, speck for Andi Kleen wrote: > >> Because the macro machinery doesn't expect the arch-dependent swap entry > >> format to be 32bit and pte to be 64bit, the results is even more macros, > >> sorry about that. > > > > Seems ugly and complicated. Perhaps it's better to just sacrifice the three bits. > > Doubt anyone will really need it anyways, especially not on 32bit systems. > > What three bits? You seem to be confusing this with my previous fix for > 64bit max swap size, but this is something quite different. You're right. > > Before this patch, PAE code did not flip the offset bits, and was using > the high pte word. That means bits 32-36 for type, 37-63 for offset. > Lower word was zeroed, thus systems with 4GB or less memory should be > safe, for 4GB to 128GB the swap type controls the "vulnerable" memory > locations, above that also the offset. Is it correct that 32bit PAE HW > phys limit is 64GB, but in the virtualized 32bit-pae guest on 64bit HW > (that you were concerned about) that limit doesn't apply? AFAIK it never applies on modern systems. > > Now if we put the swap entry to the lower word starting with bit 9 (like > 64bit), with 5 bits type we have 18 bits left for swap offset. That's > just one 1GB. In the high word we have bits to avoid for L1TF (40 to 51 > at least?) so that's even worse. IMHO we have to use the whole 64bit > entry then, which is what the patch does. Ok. -Andi