Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp260558imm; Wed, 11 Jul 2018 01:49:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfDYM9bS7YMS4mrBJlCs8K41kJpz5S7EuwsbcKp4L9v8FhNjtRbbCf7lk3qPaJLMoDqid2l X-Received: by 2002:a65:62c7:: with SMTP id m7-v6mr25336782pgv.286.1531298986389; Wed, 11 Jul 2018 01:49:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531298986; cv=none; d=google.com; s=arc-20160816; b=EpUrKDjacHE4NHElAnvHDGs+tlU9LmEmjj4LUCvOsoF829TUL43kSgwkqRPFVHMnYj XZ17pMyFuR6WaI7ueTwxT5IraKcDtAV0rFGXY6iLgcldXBHVvchspKelXfjthcqne2NQ BbZ9cRLO7EDWGpEdHvSkxbcbOECbyQZST+v0GqObm4Pa7qkfuKA5p5QmX9L3rijnJeGq a5IBH+Nr9z7FfuZGyk6DzvskEgblxJp4LQ8Sc06wa8L7u7dybVHFt+5Qez+r4OZLzvUo IhESVx8cUuRUwXR0qrhq9Ca13E5e3O5CZFR7hE7KhO0gywYdrOjCFXGcolvZFLxztQZg uuHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=P4+VFJrW/P2Cuw5bL4OTQdc6VUhjyL2TUYyqkrFBUIQ=; b=yO0yzG/4zGXUiJ7Zgke+v2n4+GgsXiJFqZZEYTIBX4A9lN6hYa4gnzAYdKqmXFGAtx fiHx1zE5vqSYSBW15WF7cvqGdA2wizo6KJ9K/gdDBi5I8D9/Cnv0qoLEwgrMRrhSjkpp 9V0dlX5sZnSHSbN735iLW3ym1g8o3LK7taoTUzB7Q2QoF3cRs/ze3TduOhjms2agpvM2 /Kg2HmTUgxaNXpea7QfgIOXQtowYbP/LJS2ohv7H+rk4PI0mbA8QO1KQ7aN5Q+ddtIm7 6AWbTSdt4Ki6EJ3s8NsgkON5BrGcNd0Z1T31mQ+W1FvaMF+qJrES4MoFAdrGbq0cTFQ8 yLGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=uv2fhSVz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si19257635pla.418.2018.07.11.01.49.30; Wed, 11 Jul 2018 01:49:46 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=uv2fhSVz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726777AbeGKIwF (ORCPT + 99 others); Wed, 11 Jul 2018 04:52:05 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34152 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726398AbeGKIwF (ORCPT ); Wed, 11 Jul 2018 04:52:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=P4+VFJrW/P2Cuw5bL4OTQdc6VUhjyL2TUYyqkrFBUIQ=; b=uv2fhSVzfbvhgIWTQUia0j1Pl KQAicZXqwWIvD5zyxxxiMgYnW7KkX9a8TcD6XYnAtSfy7jot5AE6ysI9x3iRa4RgQH0ylr/4btv34 v8D00WhaIXJu1MrQpR141RWFFRQAXFDOnzsPE5AM3bKdjXT2DUr60fYqU/IgZftr6iWiFoIsy/xmu 6fMV60APqp4nYJfvDgoYn2gWkozy/ioozkJjEsJrLkNY2JsrXpwV+X4lV9FIIRLmJC1al6TKLxGEY uIYifAnGOytqCNpFZYkMCyHr8evOjCyXiOqL15o0slAc1cYihczSv5extaKiUsrU0vgFLKff0Uhc8 mzkVJS+VA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fdAnj-0001B0-Uy; Wed, 11 Jul 2018 08:48:44 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6B4F520291063; Wed, 11 Jul 2018 10:48:42 +0200 (CEST) Date: Wed, 11 Jul 2018 10:48:42 +0200 From: Peter Zijlstra To: Dave Hansen Cc: Yu-cheng Yu , x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Cyrill Gorcunov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , "Ravi V. Shankar" , Vedvyas Shanbhogue Subject: Re: [RFC PATCH v2 11/27] x86/mm: Modify ptep_set_wrprotect and pmdp_set_wrprotect for _PAGE_DIRTY_SW Message-ID: <20180711084842.GR2476@hirez.programming.kicks-ass.net> References: <20180710222639.8241-1-yu-cheng.yu@intel.com> <20180710222639.8241-12-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 10, 2018 at 03:44:32PM -0700, Dave Hansen wrote: > On 07/10/2018 03:26 PM, Yu-cheng Yu wrote: > > + /* > > + * On platforms before CET, other threads could race to > > + * create a RO and _PAGE_DIRTY_HW PMD again. However, > > + * on CET platforms, this is safe without a TLB flush. > > + */ > > If I didn't work for Intel, I'd wonder what the heck CET is and what the > heck it has to do with _PAGE_DIRTY_HW. I think we need a better comment And Changelog, the provided one is abysmal. > than this. How about: > > Some processors can _start_ a write, but end up seeing > a read-only PTE by the time they get to getting the > Dirty bit. In this case, they will set the Dirty bit, > leaving a read-only, Dirty PTE which looks like a Shadow > Stack PTE. > > However, this behavior has been improved and will *not* occur on > processors supporting Shadow Stacks. Without this guarantee, a > transition to a non-present PTE and flush the TLB would be > needed. I'm still struggling. I think I get the first paragraph, but then what?