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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9EC2C4332F for ; Mon, 3 Oct 2022 23:56:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 439486B0072; Mon, 3 Oct 2022 19:56:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C0B36B0073; Mon, 3 Oct 2022 19:56:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 244876B0074; Mon, 3 Oct 2022 19:56:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0CBC76B0072 for ; Mon, 3 Oct 2022 19:56:31 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C579F1C19D8 for ; Mon, 3 Oct 2022 23:56:30 +0000 (UTC) X-FDA: 79981300140.17.625863F Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf29.hostedemail.com (Postfix) with ESMTP id 28CEA12001A for ; Mon, 3 Oct 2022 23:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664841390; x=1696377390; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=6XLut9fCI2BusF7FW4UFN2zGNXA0WuyqUD1GICm8FWA=; b=EB8yne2aJkLasJVleozWUbZZ0PFgXOKUJNXeMO7P15bytKQLuqHiWhEr I4wz6fmoV1vSS/Iu55DSlw1gPJHgLGvAwYojXxeJ0Zd1xuBmp47fVzymA cZM0byzTz8/sZBVDIjlcEjpB4yItpmj/OzNeFTwTYThaq7T84BtLCplSG DcuGlsCPFa+VNyOCNeH52QiNqpJqbhLvhggoTtVJAjiVzGY7NIXVh53AE wTeSILuACC8OD5Y4TJFo6YkJVAfvEMcbbUFmjpLfIo/W8g5DXRLuS8ZTF vDHdg4HLjsSu6Ae2SpnJd7ZP7Upx6zkA1JnJ82JqnkurmDvn1T68dB2yH Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="389080061" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="389080061" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.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> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664841390; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1A94S3SQqOvKJ8eK3dcCmfcnG2fA/LgLUtoMUxWN7es=; b=aFhIqQ4N8kFSoeid+F81wn/SQ7e7AzHwW9dMLffQegj/I1KizxnYyKmC+3u1u7qp4ZpNa+ x5pd8xyYsdAdLJ27hRgmGQ0mf/g0rRTIqfMVb9X5JOFkZgwkUbX0v+biB9zdqR1QMbonwJ 4VTrZexV2WR+peWChfkJL8/DRbyVmmM= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=EB8yne2a; spf=none (imf29.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.43) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664841390; a=rsa-sha256; cv=none; b=ZnoRhQsHpCQibYC+xvtMOkswtjikLLPbRYgukuD7FSztBkasGCfj41WiZfjhNs/kkOnv5z CrTe5y+98oUhRtKb/2jf01DJciPVsLcnPqdU1WtwQossdLF764jHpO0mwdNBKcjumS7SaL ROoo4U8btpBRnSINU/dfnn3x7F6ZWQs= X-Rspamd-Queue-Id: 28CEA12001A Authentication-Results: imf29.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=EB8yne2a; spf=none (imf29.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.43) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) X-Rspamd-Server: rspam06 X-Rspam-User: X-Stat-Signature: 933m15tj9n5dwg3hkp877ap5pi1fbm53 X-HE-Tag: 1664841389-307361 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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