Return-path: Received: from mx2.suse.de ([195.135.220.15]) by Galois.linutronix.de with esmtps (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1f93zH-0006tg-5B for speck@linutronix.de; Thu, 19 Apr 2018 09:28:12 +0200 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3E943AD11 for ; Thu, 19 Apr 2018 07:28:02 +0000 (UTC) Date: Thu, 19 Apr 2018 09:28:01 +0200 From: Michal Hocko Subject: [MODERATED] Re: terminal fault Message-ID: <20180419072801.GN17484@dhcp22.suse.cz> References: <20180418083529.GT17484@dhcp22.suse.cz> <20180418144556.GA9939@localhost.localdomain> MIME-Version: 1.0 In-Reply-To: <20180418144556.GA9939@localhost.localdomain> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Wed 18-04-18 10:46:05, speck for Konrad Rzeszutek Wilk wrote: > On Wed, Apr 18, 2018 at 10:35:29AM +0200, speck for Michal Hocko wrote: > > We have discussed the following patch as a mitigation for the native OS > > L1 Terminal fault issue. > > > > Intel was suggesting to set a bit outside of the uarch addressable range > > but flipping all the bits seems both easier and more future proof. So > > unless there is something else that would prevent such a fix I would > > vote to go with this patch. > > > > Thoughts? > > --- > > >From 7b03455455e1152988b2a295a917c0641f531fb0 Mon Sep 17 00:00:00 2001 > > From: Michal Hocko > > Date: Tue, 10 Apr 2018 14:10:42 +0200 > > Subject: [PATCH] mm, swap, x86: make sure high bits of the swap offset are set > > > > Intel platforms have a bug where L1 cache contents can speculatively > > be used to load content of !present entries. This allows certain side > > channel attacks. We do have several different classes of !present > > pages. Unmapped memory clears the whole ptes so they are non-issue. > > [Could you point to where this is done? I am just curious on this] e.g. zap_pte_range -> ptep_get_and_clear_full resp. similar for other pte layers. > > mprotect, numa hints are referring to an existing pfns which cannot be > > tweaked by an attacker to a different privilege domains. So we are left > > with swap entries which encode the swap offset and that might conflict > > with an existing pfn. Obfuscate those entries by inverting bits in the > > swap offset which will set all the high bits and that _should_ stop the > > speculation as it should refer to the maximum addressable memory on all > > Intel platforms. > > > > Well this doesn't solve the problem on very large offsets (1<<30 on > > uarchs with 44b addressing) but this should be out of any practical > > attack space. > > How does this help if your max memory is at the tip of the max physical support? > > That would mean we will allow the top of the memory to leak in the L1 > cache won't it? If your swap offset is that large then yes. But is this a realistic scenario to exploit? The changelog is explicit about this and we might be more anal and fail to swap on such a large partitions/files but I do not see much point making this more complicated than necessary. Or have I misunderstood your concern? -- Michal Hocko SUSE Labs