From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 349EDC433E5 for ; Mon, 22 Mar 2021 11:32:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F38B061992 for ; Mon, 22 Mar 2021 11:32:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229547AbhCVLbw (ORCPT ); Mon, 22 Mar 2021 07:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230134AbhCVLbP (ORCPT ); Mon, 22 Mar 2021 07:31:15 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA159C061762 for ; Mon, 22 Mar 2021 04:31:14 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id b14so7442989lfv.8 for ; Mon, 22 Mar 2021 04:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=W1w9xIW1N250EUFGaucw8NiWDfeMcMLKF9xerDg59Sg=; b=c8J6d+uJpziOInuiIgF76cKwKfjWpAdkplio0YS0yU0VhpyjuGkexA0TobTPHyIjJr trsjfvWByIY/pi+0UcM2oqIF7zijUwZs0dfE3o5z9zzGgEnuG0pzidW8HOSfnDZHaMX1 Bb32BHW+e7ySRAd8v8+mq/XRcXflQxECYQ/6xQsXU2cjXPiQ8eypqlS/m0VaH+YfL0+M 4pl/aE7uJGtdjjy2pjq7drs/mHGYw1XxrFx+diLJRzr3olG9nyezX7top3qh2FK/Px9Z PDWIgxpHu++lZV7p0y83RURtTNJifTURhS11QivpmZYQeWNxVhlB6Mg4D9wVuNNDilSw P5BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=W1w9xIW1N250EUFGaucw8NiWDfeMcMLKF9xerDg59Sg=; b=Zn1GlzRRpT07F7LGLQJECq732i0TmJTwoh+UhWfnmrZN7/KtksimqszQ2ZQVedGgYL hREfapR2s5NbPjK8cR7fAXNtPho7HgvN1yZXkC96jeR8JrTQRLk3ZFLAscehaPLSPJui 5KNdDN/XlTJpPJTT6GdZUun4JmaD+OcPyU8oabQRBWCkoC25mg6QhzFwLOsk0RwDN46s NQKM+anGAjkHTyXowXYcRE1D7NwhlRXFtlj/d43OdXLepmhuWKLqYr8LlLG30MtC5CDG 3+7xyoSF2Hh2BUngONkLVsBT7IpBpRe+vzdtl1y+oHLKj1EcR6F+uj4NSEd+XigO1ZQf queA== X-Gm-Message-State: AOAM533v5m8YSirxd7oCLHru6FHP1ozspwUQ+c04mbrgaeN+umF9I8BL XuedEWi9kOGjw0kloMkfH5hm7A== X-Google-Smtp-Source: ABdhPJxx6w/IrkyzNZNe9wJX93bhPJOm2+KsH61p1K12gRn3V/V44NNZfa5MrvxW018BX205rCWNNw== X-Received: by 2002:ac2:41c5:: with SMTP id d5mr8760075lfi.459.1616412673497; Mon, 22 Mar 2021 04:31:13 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id p22sm1546237lfh.113.2021.03.22.04.31.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 04:31:13 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 87326101DEB; Mon, 22 Mar 2021 14:31:20 +0300 (+03) Date: Mon, 22 Mar 2021 14:31:20 +0300 From: "Kirill A. Shutemov" 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 , 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 , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang , Pengfei Xu , Haitao Huang Subject: Re: [PATCH v23 11/28] x86/mm: Update pte_modify for _PAGE_COW Message-ID: <20210322113120.4qloiyj4ojmiis6n@box> References: <20210316151054.5405-1-yu-cheng.yu@intel.com> <20210316151054.5405-12-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210316151054.5405-12-yu-cheng.yu@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 16, 2021 at 08:10:37AM -0700, Yu-cheng Yu wrote: > The read-only and Dirty PTE has been used to indicate copy-on-write pages. > However, newer x86 processors also regard a read-only and Dirty PTE as a > shadow stack page. In order to separate the two, the software-defined > _PAGE_COW is created to replace _PAGE_DIRTY for the copy-on-write case, and > pte_*() are updated. > > Pte_modify() changes a PTE to 'newprot', but it doesn't use the pte_*(). > Introduce fixup_dirty_pte(), which sets a dirty PTE, based on _PAGE_RW, > to either _PAGE_DIRTY or _PAGE_COW. > > Apply the same changes to pmd_modify(). > > Signed-off-by: Yu-cheng Yu Reviewed-by: Kirill A. Shutemov -- Kirill A. Shutemov