Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5262327imm; Sun, 26 Aug 2018 15:05:33 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda9S2UDV+yFX5mNVI7fxOgEo1p5PUR/Xw1eBP3lq8FABWZUJVeQsPi1+7lOPZf63hUna0Cs X-Received: by 2002:a63:555c:: with SMTP id f28-v6mr9843941pgm.37.1535321132992; Sun, 26 Aug 2018 15:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535321132; cv=none; d=google.com; s=arc-20160816; b=GBBWk4CnCCVBTR+A7WBK9F67TcxdT55r44XtkS/4mAZD5y8xvVFDWiOUpRrfCv1wj5 i5I07jXK+2wihMkkjYyWHDghKUWrce4GzeDufdx69K+hi/riJtDDbe+mrZ1YTpxC1ivS iE/nkTCfTvzLjs9iCBHgm79rbamyowGpkuzkfQOQ4cTQ/kPVKhdJQsehxsIK3hzza9uP iHYHv8EoCgWdd7RC1OiTkTL3/HOAzQHiCjfXw2vGVz4l+fAxr7JoUlEtPUM5pXou92hC quyuX/orQTQYSGQaFgjhVjlLj71x1hwsCDS0PSseOO7W7F1GUu0RVlhhhhquLQvmBXv1 5pIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Vw/vpMtNloNfEZxPwTTY9XIGpMEqoQcmV42JHdQlmdY=; b=rBoh1tA0+XBwsPEAxdKBcy85HZG6dzOhfVRQZX2ctKrQUz+CRqpuZh01FF5T5pH/EX bjhaXLDo8lSjGDLax8CD4VEg+jTA3/ZF/4Zt4SrU188CvqIvuFanWaZOHvR/lhHWNori hb3mDSovgXLcoaYuWSUvgW4Pbwt2VXWSQrx0ad0G6hGLs5CFW3cdR+mF1ZC/jXmSksf/ Dh+gjF01FU2oiFZ/0gAgokLDxF6LtNkBMrJD0iNhVJ+3yepnNXJ8oKHj4okrQ4ThMluW oWw2VbN/5Qmt3ufkWmTsR+nKF8BsrVS9W2G75sAdHonfrfG9v4t08aJy5p8A1ODLycIo M85Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=O3C3h+1V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92-v6si13250236plw.81.2018.08.26.15.05.14; Sun, 26 Aug 2018 15:05:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=O3C3h+1V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726939AbeH0Brz (ORCPT + 99 others); Sun, 26 Aug 2018 21:47:55 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:38155 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726802AbeH0Brz (ORCPT ); Sun, 26 Aug 2018 21:47:55 -0400 Received: by mail-yw1-f66.google.com with SMTP id n21-v6so4824849ywh.5 for ; Sun, 26 Aug 2018 15:04:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Vw/vpMtNloNfEZxPwTTY9XIGpMEqoQcmV42JHdQlmdY=; b=O3C3h+1VmW4rfHW8p5+eiDiCaYBhkRFAmquqQVvJZW5u7q0s2n56y5kGu93nkglFZd AFmK35IKgfSdwCWQ4ZPA/8VwUC6ccD7M3RtORls6Gr4gNSwXb+w/X6cIDn5NfWqylpjc C3HlCljCkYvRKKPDFP31q8HABP9LpqJdy+5/Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Vw/vpMtNloNfEZxPwTTY9XIGpMEqoQcmV42JHdQlmdY=; b=noUwg04wFM7pXS13DeWec7sUQgrku2pVeaE3diGgjTPswbJGCvwyT6nFxwW66j//YZ IYGFgAZGVZi1ZUMCznFnfaKDPv0aLYPVmpem2p5gGm0xmt5dJ/kwFP9mzk89JPwi0ouA rYJrosNdzqiXwCpbfIKzEWA4QIoHBlLPZ8gwas49V+C/wjTciGtzjlJ82hfaHBMLqQ5h x8XY4cPuruKbU0wdIQnPl3/hEJmVR3r9A4Gdgqv37DZSEG2OQ3fDS7ryyOxW9Zi9Jc4K 5zRerhsAIpvkWqx0nNMX1eB5VTQSJh+4mQn4nY2VSAiKv4kZl9B4YHF+C2fsYnraU+tf Ny8Q== X-Gm-Message-State: APzg51D4vQm9NKDqjioIR2fxch0EKcnjccpupPc59uuzFZ2rBhxO1ILA CVl0iuEULJFnACIEBe+/QGmW/HTfJes= X-Received: by 2002:a0d:db89:: with SMTP id d131-v6mr5768165ywe.318.1535321042913; Sun, 26 Aug 2018 15:04:02 -0700 (PDT) Received: from mail-yb0-f178.google.com (mail-yb0-f178.google.com. [209.85.213.178]) by smtp.gmail.com with ESMTPSA id s63-v6sm5800894ywd.63.2018.08.26.15.04.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Aug 2018 15:04:01 -0700 (PDT) Received: by mail-yb0-f178.google.com with SMTP id o17-v6so5383364yba.2 for ; Sun, 26 Aug 2018 15:04:01 -0700 (PDT) X-Received: by 2002:a25:19c3:: with SMTP id 186-v6mr5773553ybz.410.1535321040528; Sun, 26 Aug 2018 15:04:00 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:2c11:0:0:0:0:0 with HTTP; Sun, 26 Aug 2018 15:03:59 -0700 (PDT) In-Reply-To: References: <20180822153012.173508681@infradead.org> <20180823133958.GA1496@brain-police> <20180824084717.GK24124@hirez.programming.kicks-ass.net> <20180824180438.GS24124@hirez.programming.kicks-ass.net> <56A9902F-44BE-4520-A17C-26650FCC3A11@gmail.com> <9A38D3F4-2F75-401D-8B4D-83A844C9061B@gmail.com> <8E0D8C66-6F21-4890-8984-B6B3082D4CC5@gmail.com> <20180826112341.f77a528763e297cbc36058fa@kernel.org> <952A64F0-90B3-4E2F-B410-7E20BE90D617@amacapital.net> From: Kees Cook Date: Sun, 26 Aug 2018 15:03:59 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: TLB flushes on fixmap changes To: Thomas Gleixner Cc: Andy Lutomirski , Andy Lutomirski , Masami Hiramatsu , Nadav Amit , Linus Torvalds , Paolo Bonzini , Jiri Kosina , Peter Zijlstra , Will Deacon , Benjamin Herrenschmidt , Nick Piggin , "the arch/x86 maintainers" , Borislav Petkov , Rik van Riel , Jann Horn , Adin Scannell , Dave Hansen , Linux Kernel Mailing List , linux-mm , David Miller , Martin Schwidefsky , Michael Ellerman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 26, 2018 at 1:15 PM, Thomas Gleixner wrote: > On Sun, 26 Aug 2018, Andy Lutomirski wrote: >> > On Aug 26, 2018, at 9:47 AM, Kees Cook wrote: >> >> On Sun, Aug 26, 2018 at 7:20 AM, Andy Lutomirski wrote: >> >>> I tried to convince Ingo to use this method for doing "write rarely" >> >>> and he soundly rejected it. :) I've always liked this because AFAICT, >> >>> it's local to the CPU. I had proposed it in >> >>> https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=kspp/write-rarely&id=9ab0cb2618ebbc51f830ceaa06b7d2182fe1a52d >> >> >> >> Ingo, can you clarify why you hate it? I personally would rather use CR3, but CR0 seems like a fine first step, at least for text_poke. >> > >> > Sorry, it looks like it was tglx, not Ingo: >> > >> > https://lkml.kernel.org/r/alpine.DEB.2.20.1704071048360.1716@nanos >> > >> > This thread is long, and one thing that I think went unanswered was >> > "why do we want this to be fast?" the answer is: for doing page table >> > updates. Page tables are becoming a bigger target for attacks now, and >> > it's be nice if they could stay read-only unless they're getting >> > updated (with something like this). >> > >> > >> It kind of sounds like tglx would prefer the CR3 approach. And indeed my >> patch has a serious problem wrt the NMI code. > > That's exactly the problem I have with CR0. It leaves everything and some > more writeable for any code which can interrupt that section. I thought the point was that the implementation I suggested was NMI-proof? (And in reading Documentation/preempt-locking.txt it sounds like disabling interrupts is redundant to preempt_disable()? But I don't understand how; it looks like the preempt stuff is advisory?) -Kees -- Kees Cook Pixel Security