Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3551164rwb; Mon, 3 Oct 2022 17:24:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mAv6uMLhAID6TF0PtW5QQouGNYfa1RSsqWJid6GCopcliO/Fs09XmVLFbTmk3jz+5e5hK X-Received: by 2002:a63:5553:0:b0:43c:5c1e:424f with SMTP id f19-20020a635553000000b0043c5c1e424fmr20951170pgm.353.1664843092305; Mon, 03 Oct 2022 17:24:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664843092; cv=none; d=google.com; s=arc-20160816; b=rXDgBbd98SGHIkhDJUF+u1HGVAuFRNmFVe12YYnLwx0iioqI5oN2KZKwhCKh0nWNNJ 5z+jZT3YYlZ71p9WVCeFhUEDWSdm8H4zwiEPsY51dCfG4GyvROGsTD9LBKMihRAnCqMX kLvk00zmBB68rrfV9vV+ulpuQTaUfmqIaRH7XAFOOBna5pN3x0pzzn7CyZb2DbStF5nF HKUu89NWrmX+WldDpPbzmpwEGcMdQBSIYqxZD6sem/DyULBLVoj3w9XUfHBSpoefw+dn 3EZtfLu2xGdDCW/CFMFYzBnSy8yvt9m3sDWTOLDgmF+amPT9rq8vDRTcVVWnKTonsjXC flPg== 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=1A94S3SQqOvKJ8eK3dcCmfcnG2fA/LgLUtoMUxWN7es=; b=YP6aoi6CoLsAxrIEeld4X5bcilq909L3ZUJEKKkMND3U5BaTsP6LMrB3vzxj1kuDEK X5/3rWCYG+EV3YY+OOBTveTeTVhDZDCjqmLqU7/VoVKtmlfT/qCoJ3decyFAi5C4XDlg PxUKRypmFUDf6VzIY94XNF43c/ynB1/gCyqklxlOZUQ0JDoCSYZK3ownugSehR+w1NyH fXXTz8AXIuSh9qSTpT5hbGJ+YxOFniXoJLUZHuAVM1whzhqFj9uubDTd1yToTrpmBg4o Som42CKpFadXvLjt0nz9FRfEhzyaW5UWq0iC5SN5tHXk3mW3bhoHYloSw5XRX/pZxjvE sVdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PAU7jXCX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020a170902ce0300b0017a08290efbsi11463733plg.558.2022.10.03.17.24.39; Mon, 03 Oct 2022 17:24:52 -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=@intel.com header.s=Intel header.b=PAU7jXCX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229885AbiJCX4b (ORCPT + 99 others); Mon, 3 Oct 2022 19:56:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiJCX43 (ORCPT ); Mon, 3 Oct 2022 19:56:29 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 297F6F0A; Mon, 3 Oct 2022 16:56:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664841389; x=1696377389; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=6XLut9fCI2BusF7FW4UFN2zGNXA0WuyqUD1GICm8FWA=; b=PAU7jXCXQYiz8NqgKQf8+4NJWWbl1yGODwG5+fnF+p92uRIGDVm6Lhbb B8FNQNL1PrmriklqWKLGv5v3bV7bRNQPkbkjeD+w9m0SkA7kuZJP5xF5I ZJLH4XAZqrRygFzOsPeXxP7JxrlhfE7bWmEQw5A3PrvRgeMrQjC23kBCo gf3DUx3Kke35r8VTAOI74PNy/ILtzgINX8AOTI2MWz9Mo09TUXF08XPy6 YmYedasf0joNyRPdlf9Z16qllA4xmlFgAApnYn61uLV1MQpBcCSJ2Nwaw F871L8h2TLvkBUpw8SNQHwkf1mo63p2msxYuxinZmv9I1L6f/D3RprrKX w==; X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="302767653" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="302767653" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2022 16:56:28 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="712821467" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="712821467" Received: from bandrei-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.37.219]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2022 16:56:21 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 1D6F3104CE4; Tue, 4 Oct 2022 02:56:19 +0300 (+03) Date: Tue, 4 Oct 2022 02:56:19 +0300 From: "Kirill A . Shutemov" 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 , Peter Zijlstra , Randy Dunlap , "Ravi V . Shankar" , Weijiang Yang , 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 17/39] mm: Fixup places that call pte_mkwrite() directly Message-ID: <20221003235619.qdoedbrcrplaa4tf@box.shutemov.name> References: <20220929222936.14584-1-rick.p.edgecombe@intel.com> <20220929222936.14584-18-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220929222936.14584-18-rick.p.edgecombe@intel.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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:14PM -0700, Rick Edgecombe wrote: > From: Yu-cheng Yu > > With the introduction of shadow stack memory there are two ways a pte can > be writable: regular writable memory and shadow stack memory. > > In past patches, maybe_mkwrite() has been updated to apply pte_mkwrite() > or pte_mkwrite_shstk() depending on the VMA flag. This covers most cases > where a PTE is made writable. However, there are places where pte_mkwrite() > is called directly and the logic should now also create a shadow stack PTE > in the case of a shadow stack VMA. > > - do_anonymous_page() and migrate_vma_insert_page() check VM_WRITE > directly and call pte_mkwrite(), which is the same as maybe_mkwrite() > in logic and intention. Just change them to maybe_mkwrite(). Looks like you folded change for do_anonymous_page() into the wrong patch. I see the relevant change in the previous patch. -- Kiryl Shutsemau / Kirill A. Shutemov