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 1DF5DC05027 for ; Sun, 19 Feb 2023 20:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231480AbjBSUjf (ORCPT ); Sun, 19 Feb 2023 15:39:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231224AbjBSUjc (ORCPT ); Sun, 19 Feb 2023 15:39:32 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B28C12BC8 for ; Sun, 19 Feb 2023 12:39:30 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id ky4so398674plb.3 for ; Sun, 19 Feb 2023 12:39:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=VSb9sHqoGaX0ZmNLCacxp8wGphEMlpICECfuxg/6qfo=; b=bu4z3fK3Nw4HhLOx/qgH3yNXGHbhBqxOBEwd5mLyqsfX5MQUjD7h2lfuho4muVXNow Nn81BNCLyl6wHaPe2rR7v7GePfrSc7J9n9IbIl92KLHp2WKLsoVcbNFhiKj7rV0xH2C+ 9WG0yXt0ferrSb+q0i88lvD0cAA5YyVFUZ9Kw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VSb9sHqoGaX0ZmNLCacxp8wGphEMlpICECfuxg/6qfo=; b=ViBlrkeCeu/Nat1cXSHVaS+uorGXOgMbAmUg5Xmq/NC2LEv4/fExjEJ+ogzGw07jJf PkJCd9sf5qwz6C7tGt8IbTcAdJisDDO6/TwUg2MpVWorpmr2pPL2TbdDRTXxZqZ9d2d8 FUel5vaQC7mLZyTtm04/NlxYNUOK0JdaBXBSEDSDRYYmCeLnn07AoKCdKuBQ4Jy+gAWv w6/LArRBFA6NbHq8vJrau0vxYNsGJIFtw2OTTSZ+AvMfUwamKyGxKY9oHE1TmrYh7/9T lq/mA4cRK4+mLTuukksIee1U8G4gfew0//gpMXEMRQOzYG/L/ues0QbUHQtZoa8Gpe/t wasA== X-Gm-Message-State: AO0yUKUokrB4Mu5wPORCwuLdYv4gPOiaOY2et4HtE42TTcRE1+VZEQUK E0yWF8h5pMUaO6Z+HMn9lyQ++w== X-Google-Smtp-Source: AK7set8Z0ntrqwUzPx0nvUWdIPEe1au4xT4h8TIYhX6gENNMytmy/Bxwko3qUQliHF8keZ//uamelA== X-Received: by 2002:a17:903:32cf:b0:19b:441c:3913 with SMTP id i15-20020a17090332cf00b0019b441c3913mr2016208plr.44.1676839169923; Sun, 19 Feb 2023 12:39:29 -0800 (PST) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id r6-20020a170902be0600b00199537a7466sm6345581pls.39.2023.02.19.12.39.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 12:39:29 -0800 (PST) Message-ID: <63f28901.170a0220.7090.af7b@mx.google.com> X-Google-Original-Message-ID: <202302191238.@keescook> Date: Sun, 19 Feb 2023 12:39:28 -0800 From: Kees Cook 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 , 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, debug@rivosinc.com, linux-s390@vger.kernel.org Subject: Re: [PATCH v6 12/41] s390/mm: Introduce pmd_mkwrite_kernel() References: <20230218211433.26859-1-rick.p.edgecombe@intel.com> <20230218211433.26859-13-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230218211433.26859-13-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:04PM -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 pmd_mkwrite() to create different > types of writable memory (the existing conventionally writable type and > also the new shadow stack type). Future patches will convert pmd_mkwrite() > to take a VMA in order to facilitate this, however there are places in the > kernel where pmd_mkwrite() is called outside of the context of a VMA. > These are for kernel memory. So create a new variant called > pmd_mkwrite_kernel() and switch the kernel users over to it. Have > pmd_mkwrite() and pmd_mkwrite_kernel() be the same for now. Future patches > will introduce changes to make pmd_mkwrite() take a VMA. > > Only do this for architectures that need it because they call pmd_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-kernel@vger.kernel.org > Cc: linux-s390@vger.kernel.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 Yup, 1:1 refactor. Reviewed-by: Kees Cook -- Kees Cook