Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp376589rwi; Fri, 14 Oct 2022 03:23:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6BKA12RdXvkLTJ6Mhy3wercWw06t/oeAxHQUP7Y3/jaKk1eJbkp+/FIZYbF5vjkrkERhFC X-Received: by 2002:a05:6402:350f:b0:45d:1d86:9ec9 with SMTP id b15-20020a056402350f00b0045d1d869ec9mr2301583edd.266.1665743012336; Fri, 14 Oct 2022 03:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665743012; cv=none; d=google.com; s=arc-20160816; b=vzZBiiMluEAQtSfur/jWLlG7lSxPuOwsptTQv4jHslBsl71EfQbfH1COXc91Xq0WUd TM+4Zj8xl1ZjR5VHjqXqzOLxJO6WqMpVzvTJL5e2hrbPBeHd7/OWsvwCrz73xKHjOuvD 5lpSDSc7VfzmLvYdaceMvi3Tn17u9naTGp743bBPMEj2+bc0UaUjrNQB2X4skJCg0laT I/mJ+vgusfAN0zmgfvCjekjh+uNFRynSnW36xeJnALnXjyrNEYKYrvn3bopvt6jQHQtL nPzGi4eVSaiznmZoGvkC6ctUPfDFuBP/sNFphmb9dAWYeHj8/fUohVJTDD2fqmIM6NmF UZMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=j68hgOrkjo4GGasFG1vTrc8ztTwD88q1qsBwVyQ1Wuc=; b=R4KVmTEZs1t86PDTaR863yVkQUkQTL428jpIBjOVoJz43FXgRSCw0ihkVmNREpEdEo FxLp+MqkOd00m4EAfiFm8NB3J2wbhp5DHzVqrD/KM7A4wDDMtzNQxCRlekYawQKJj2P/ +vQLz1D/GOod0r6y/W6C0pd66lAE3LUCCSrIdBSKrogkOliFWf/h9238E3KKKMygW+1C PQPIVkm/QVgNtklwmib1pkyUjZ4f6HlcVISzcN/9oIZHtALS9Tz1ZMfSeFg/zd6tezKB YVeSFhUOPbbv0PSdfLPMIehEdUqTE/tVjf/+WUwIVxCnGZoJZrVg2Xe2o7mHnYCl5wb5 6Q9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=MplQU52f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y21-20020a056402441500b004549b880c67si2303640eda.42.2022.10.14.03.23.07; Fri, 14 Oct 2022 03:23:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=MplQU52f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229774AbiJNJm6 (ORCPT + 99 others); Fri, 14 Oct 2022 05:42:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229975AbiJNJmq (ORCPT ); Fri, 14 Oct 2022 05:42:46 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6CA814DF2A; Fri, 14 Oct 2022 02:42:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=j68hgOrkjo4GGasFG1vTrc8ztTwD88q1qsBwVyQ1Wuc=; b=MplQU52fBaglr236u9ScGhovH3 oOemWW9AmwGD+pFB09HHDp1rdG3ndu7ekn1V+qkqm3uBaDsMYnUotdB7imWv+t6zzv3H+KExDqTZH zKwL3dD2GA2ikVFDkzoxMtwm/CjDFTMHCpiWjcKRk5GBo1ePsEJ38D4GztebpoTTMU2f8TQxF+jJB C7OqWXh/odDEmNX4XTSx1HytVPHwFvgh3J3g7ZZ1aEfWlMUPgzqW+HWH51pyqV9ncmxfqywnTSlAW kGYouxzMG/Lbp8dgUw0CtWpDrAFZnii6CVq0XtPQXx4xNwpTdfNlpUyplPHQhgD2yaoYKiHpz1K4H 2S/T03yw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ojHD1-007W9P-Dq; Fri, 14 Oct 2022 09:42:27 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8619430012F; Fri, 14 Oct 2022 11:42:22 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 71B1B2C164D13; Fri, 14 Oct 2022 11:42:22 +0200 (CEST) Date: Fri, 14 Oct 2022 11:42:22 +0200 From: Peter Zijlstra To: Rick Edgecombe 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 , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H . J . Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Randy Dunlap , "Ravi V . Shankar" , Weijiang Yang , "Kirill A . Shutemov" , joao.moreira@intel.com, John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com, Yu-cheng Yu Subject: Re: [PATCH v2 10/39] x86/mm: Introduce _PAGE_COW Message-ID: References: <20220929222936.14584-1-rick.p.edgecombe@intel.com> <20220929222936.14584-11-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220929222936.14584-11-rick.p.edgecombe@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 29, 2022 at 03:29:07PM -0700, Rick Edgecombe wrote: > @@ -300,6 +324,44 @@ static inline pte_t pte_clear_flags(pte_t pte, pteval_t clear) > return native_make_pte(v & ~clear); > } > > +/* > + * Normally the Dirty bit is used to denote COW memory on x86. But This is misleading; this isn't an x86 specific thing. The core-mm code does this. > + * in the case of X86_FEATURE_SHSTK, the software COW bit is used, > + * since the Dirty=1,Write=0 will result in the memory being treated > + * as shaodw stack by the HW. So when creating COW memory, a software > + * bit is used _PAGE_BIT_COW. The following functions pte_mkcow() and > + * pte_clear_cow() take a PTE marked conventially COW (Dirty=1) and > + * transition it to the shadow stack compatible version of COW (Cow=1). > + */