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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C4A9C7EE32 for ; Wed, 1 Mar 2023 15:39:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229679AbjCAPjT (ORCPT ); Wed, 1 Mar 2023 10:39:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjCAPjN (ORCPT ); Wed, 1 Mar 2023 10:39:13 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E122F15160 for ; Wed, 1 Mar 2023 07:39:12 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id n5so8167088pfv.11 for ; Wed, 01 Mar 2023 07:39:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1677685152; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=G88lHAU8EQsCcXmuw5k8V0o7uYf93X0m0EbK56nmCkc=; b=Ny+HmlrE0gXICVns/E53J7P+ufLy4O/6mPMZ9p2rf+anhUNDxXReAJ7Of7RumsIo7i MF0of+OFSSVag+jJbKJCbWqw/7+3QP1Ep9RYaalmJO09mE4viOw8S2klvVFaryWM8jl2 TtVtqnAAOEN9R1ADWrsxZJSJWmuT6eBeUtGvwmxtiW6+g7vic+774Z/gaDYyszuozffC OjXIGEYSwLxa1xaHosEo3E4lK3jZqYXbE8AJSAcyVW/Ya9OJJK8u4pEJ6QPLxpJdgj2D ds5e0Mvpliu5fpO+nw6SVbgSyG5paByNt+L/3lCiP7+YU4Hd4Qok+ddJgLOslD7RpwmT /2tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677685152; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=G88lHAU8EQsCcXmuw5k8V0o7uYf93X0m0EbK56nmCkc=; b=oaI7shcY7vsH8KrdxadAQ9x0aF1015vnWQYAFEj2ZmkcqCcfWbMowY2VE+OWfVx3L6 EyjaMD1ak0UD5/XAPX+F5+wM7MHTqr6f/fUM+OjmNM2OXqAsu+g2AU1fHKeeSM45YHaK LtChceeWhW6AXbqF34AUhO1mhb+6QN6E4UdquTEL8OqJ5hSgSRbcYm0EeBQpIKm6pHOD YK+yHRQ8fUvz4IeJ0tVckFFJWQ3Hf7cevbor5Mjfo+BNMVqVZBrAhh/Jj0bHg20Wpk2x sxPQ2uclDLKkq+nBBOsWfPjxKlrptVSxjlfrWYgLGjqr/PzlBIxLRmoMkIOOw5LSngPz mj/Q== X-Gm-Message-State: AO0yUKW4ZdWZYn4ggzTJ7f0yLTmevVY2oBuLxtVMGQtXShhmmuE3PYVu pqVezXzVEAwYr8/84vFNTH0tnA== X-Google-Smtp-Source: AK7set8O+FBRYvI4IODXsFr4hn8ba9dIyWnvB6rPeJHmFqFJ7d5V8y8v1teRy0/jHqbFKVQ/Seo5yA== X-Received: by 2002:aa7:9ac2:0:b0:5a8:ea06:662 with SMTP id x2-20020aa79ac2000000b005a8ea060662mr6767366pfp.20.1677685152202; Wed, 01 Mar 2023 07:39:12 -0800 (PST) Received: from debug.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id j13-20020a62b60d000000b005a8851e0cddsm8070167pff.188.2023.03.01.07.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 07:39:11 -0800 (PST) Date: Wed, 1 Mar 2023 07:39:08 -0800 From: Deepak Gupta 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 , Weijiang Yang , "Kirill A . Shutemov" , John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com, akpm@linux-foundation.org, Andrew.Cooper3@citrix.com, christina.schimpe@intel.com, david@redhat.com, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, xen-devel@lists.xenproject.org Subject: Re: [PATCH v6 11/41] mm: Introduce pte_mkwrite_kernel() Message-ID: <20230301153908.GA3505369@debug.ba.rivosinc.com> References: <20230218211433.26859-1-rick.p.edgecombe@intel.com> <20230218211433.26859-12-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20230218211433.26859-12-rick.p.edgecombe@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 18, 2023 at 01:14:03PM -0800, Rick Edgecombe wrote: >The x86 Control-flow Enforcement Technology (CET) feature includes a new >type of memory called shadow stack. This shadow stack memory has some >unusual properties, which requires some core mm changes to function >properly. > >One of these changes is to allow for pte_mkwrite() to create different >types of writable memory (the existing conventionally writable type and >also the new shadow stack type). Future patches will convert pte_mkwrite() >to take a VMA in order to facilitate this, however there are places in the >kernel where pte_mkwrite() is called outside of the context of a VMA. >These are for kernel memory. So create a new variant called >pte_mkwrite_kernel() and switch the kernel users over to it. Have >pte_mkwrite() and pte_mkwrite_kernel() be the same for now. Future patches >will introduce changes to make pte_mkwrite() take a VMA. > >Only do this for architectures that need it because they call pte_mkwrite() >in arch code without an associated VMA. Since it will only currently be >used in arch code, so do not include it in arch_pgtable_helpers.rst. > >Cc: linux-doc@vger.kernel.org >Cc: linux-arm-kernel@lists.infradead.org >Cc: linux-s390@vger.kernel.org >Cc: xen-devel@lists.xenproject.org >Cc: linux-arch@vger.kernel.org >Cc: linux-mm@kvack.org >Tested-by: Pengfei Xu >Suggested-by: David Hildenbrand >Signed-off-by: Rick Edgecombe > Acked-by: Deepak Gupta