Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp327185imm; Wed, 11 Jul 2018 03:13:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpevXV7mqIk2AFXYbi/YNWkgAP+YBDm/rT010QRBJMrTCHRHZsHhh4YmteMekUBdIJBTvziw X-Received: by 2002:a17:902:20ca:: with SMTP id v10-v6mr27765077plg.255.1531304006687; Wed, 11 Jul 2018 03:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531304006; cv=none; d=google.com; s=arc-20160816; b=DgYx/SVA8Y5Pt7bEt/PSMv+NxIz/Zkg3FSVTQh1o/z54WCSWdvkaAoTG80hm/Prd9Q VZFR0KWhSicQK6LuIVDOpOyw5SB4oVW0yRHWpUZh9bUl7Y9t4LViVlPkjZ9iwti53h6G oRS5RP28CNOOMxXfUOWRwcIctkk/F0pF/mFpqP74blCXdFMw1VSp/QILHsBAx+GYeL5C SBAX3IzFEmddcjvHkwHlFXsbcqbIrG0Abu2RnfvMZx/BHh2mWDmqndS/XXyN3Wzfw2QR sc/9XKTDsVdGoKwIpVl638Ltxt71huDzi2tS6CuDWHlOku2JC05lOksbjLNPlzNZVDaO +Lqw== 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=HNfZeAyOUk6CW6jcqB/Fxzu6JdX1Qdcn48KtH6knTyA=; b=sp+UksA2YCUWJxfrWkNXJjePAjULUVzD/E2DJIzzjE97/F2yaw6KIZHs/32Y9G+XNI fa0uEsDcYUbb293YZJMhZHaqWzsbuQxECteB/mLAaFGbJ0mPPy7GTl1rJNGlznDZV2K2 DCLYQOuHWqBXskjwyyIkcjsRQ+Cr1vZVvpR1x1ojDMGbpY0jQ/k9O7/nY9y/LNxhQz5q yf1UNxSkrzom8qlOmabyvmUQ7jMevNUc98JZV8IN1G/LJu++4IxKrmPtzoBgsGqO32Se UlePX8671vljCA/LB0uKdmJPBPpyInH3v6RLuapPi+gXOZU3llvPU3X5NdneR5F1o2nE KAEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Stc7DE4q; 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 p187-v6si19822942pfp.125.2018.07.11.03.13.11; Wed, 11 Jul 2018 03:13:26 -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=Stc7DE4q; 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 S1726835AbeGKJdY (ORCPT + 99 others); Wed, 11 Jul 2018 05:33:24 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:51608 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726368AbeGKJdY (ORCPT ); Wed, 11 Jul 2018 05:33:24 -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=HNfZeAyOUk6CW6jcqB/Fxzu6JdX1Qdcn48KtH6knTyA=; b=Stc7DE4qm7DUgMExJifJ6g72m XRgpSoJ3tR8xnZSiD/MA19wKq1as9PGJlZgRMdgbh6Aa5A41PJ9Bpa1tuq8+sF2x5RcizJv4qzBlc Qeb5RtPLCdq61vOAD4Zd/OyBPfDtEbpXx9iv/hvQ4IJB1gtDqflOMzAUtIb92QBOh0JDQVzJxR9T7 VTh82WrAgibyqXydHugtAuZB2poqrHr+2UpnaSAOmw9QoVDF68nFoxpSUKMMHTw+8oAzEEwBKgsYa I29JIkNLAXIxrnW/RFkjiaEjg+gkEZ/ze42j8X6bW1xO1LWXYHKPYdPK+d4GaO0gHBkTYtLvhb6z2 KsKwToA1g==; 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 1fdBRZ-0004eh-67; Wed, 11 Jul 2018 09:29:53 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4F2F820291063; Wed, 11 Jul 2018 11:29:51 +0200 (CEST) Date: Wed, 11 Jul 2018 11:29:51 +0200 From: Peter Zijlstra To: Yu-cheng Yu Cc: 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 , Dave Hansen , 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 16/27] mm: Modify can_follow_write_pte/pmd for shadow stack Message-ID: <20180711092951.GW2476@hirez.programming.kicks-ass.net> References: <20180710222639.8241-1-yu-cheng.yu@intel.com> <20180710222639.8241-17-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180710222639.8241-17-yu-cheng.yu@intel.com> 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:26:28PM -0700, Yu-cheng Yu wrote: > There are three possible shadow stack PTE settings: > > Normal SHSTK PTE: (R/O + DIRTY_HW) > SHSTK PTE COW'ed: (R/O + DIRTY_HW) > SHSTK PTE shared as R/O data: (R/O + DIRTY_SW) I count _2_ distinct states there. > Update can_follow_write_pte/pmd for the shadow stack. So the below disallows can_follow_write when shstk && _PAGE_DIRTY_SW, but this here Changelog doesn't explain why. Doesn't even get close. Also, the code is a right mess :/ Can't we try harder to not let this shadow stack stuff escape arch code.