Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750868AbeAOUJq (ORCPT + 1 other); Mon, 15 Jan 2018 15:09:46 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:41622 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750710AbeAOUJo (ORCPT ); Mon, 15 Jan 2018 15:09:44 -0500 X-Google-Smtp-Source: ACJfBovUC9bqd08H1BjtM61C5p1LQ85m+VrwB0uurIEHYtOrVrY6tYzK2X093A56aFIWx8hbxAtIBw== Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [RFC] x86: Avoid CR3 load on compatibility mode with PTI From: Nadav Amit In-Reply-To: <57a8fa6b-a1d1-d440-ce13-b1d06d265584@linux.intel.com> Date: Mon, 15 Jan 2018 12:09:41 -0800 Cc: LKML , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , the arch/x86 maintainers , w@1wt.eu Content-Transfer-Encoding: 8BIT Message-Id: <3D823F02-89EF-48D9-913D-5E65391F6F9D@gmail.com> References: <20180114201306.3554-1-namit@vmware.com> <57a8fa6b-a1d1-d440-ce13-b1d06d265584@linux.intel.com> To: Dave Hansen X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Dave Hansen wrote: > On 01/14/2018 12:13 PM, Nadav Amit wrote: >> Currently, when page-table isolation is on to prevent the Meltdown bug >> (CVE-2017-5754), CR3 is always loaded on system-call and interrupt. > > I think of PTI as being a defense against bad stuff that happens from > the kernel being mapped into the user address space, with Meltdown being > the most obvious "bad" thing. > > What you're saying here is that since a 32-bit program can't address the > kernel sitting at a >32-bit address, it does not need to unmap the > kernel. As Andy pointed out, there are a few holes with that assumption. I think that Andy pointed out that my RFC may break existing programs, but it should be relatively easy to fix. I don’t think there is any problem with the assumption. > IMNHO, any PTI-disabling mechanisms better be rock-solid, and easy to > convince ourselves that they do the right thing. For instance, the > per-process PTI stuff is going to make the decision quite close to a > capability check, which makes it fairly easy to get right. Per-process PTI stuff is an easy solution, but it just pushes the decision to the user, who is likely to disable PTI without thinking twice, especially since he got no other option. > If we start disabling PTI willy nilly at points _away_ from the > capability checks (like for 32-bit binaries, say), then it gets really > hard to decide if we are doing the right things. Eventually it comes down to the question: what does the CPU do? I was assuming that Intel can figure it out. If it is just about being “paranoid”, I presume some paranoid knob should control this behavior. > Also, what's the end goal here? Run old 32-bit binaries better? You > want to weaken the security of the whole implementation to do that? > Sounds like a bad tradeoff to me. As Willy noted in this thread, I think that some users may be interested in running 32-bit Apache/Nginx/Redis to get the performance back without sacrificing security.