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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56D9AC6379F for ; Mon, 20 Feb 2023 11:20:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231748AbjBTLUp (ORCPT ); Mon, 20 Feb 2023 06:20:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbjBTLUj (ORCPT ); Mon, 20 Feb 2023 06:20:39 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C83C93C1 for ; Mon, 20 Feb 2023 03:19:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676891987; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4Y0d/vI0Qp2mhR9IQ+0FEQIh8Qkf0r9E2FFAh9KN8Lg=; b=SnD3OxKHIAk39zwowbiV9/1S027SKew+gek9VljiPPVLtnSnMXyozFMNg77hehg9IHDDqw f97+8wKgJqW5rCs3WCwq+I65MYTfXQhr+St+YTB+Ue4oD5yc4sgVFY2zbU6tgwkqvMKVeI rKebOasRafFU3IR4JIhcGhP08HfATpw= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-269-tN8ihUIBN6aeBbL-ilvEFQ-1; Mon, 20 Feb 2023 06:19:46 -0500 X-MC-Unique: tN8ihUIBN6aeBbL-ilvEFQ-1 Received: by mail-wm1-f71.google.com with SMTP id t1-20020a7bc3c1000000b003dfe223de49so500718wmj.5 for ; Mon, 20 Feb 2023 03:19:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4Y0d/vI0Qp2mhR9IQ+0FEQIh8Qkf0r9E2FFAh9KN8Lg=; b=vB7vqO42SdXP52p4/B2dF9rhOboRy+JbeJ5JSVCT3vdvBFnC9UbLguE8/UvQOtS6Td 5PALpHuGiaCOLDLOAjCgvnQrB2ykJkbwh9X4Yx9Oom6qI9t3bEy4pOGq6f89LuU6/lDk JQiYvTCGKcpqJPyiaoozmwCiu5DYsUIOlYLh4yT/aHpBKvdhRJCPWEtTUrgBzvL0OR26 yNSqI3MIoV7MgIVHfeV5yRZFsQ/vopU9/MbeqF5PtNCOIcZg5BoyWxtOoy6hxDFnJaa/ hVlQFBALsb2hfm5q6DVbKLYTLW0CqMmhjVS6tQ2wCeYOo0LJe5f6MlowkZA9HWnxaNuR FuHQ== X-Gm-Message-State: AO0yUKX2x3C5t7sfmco2oMypG+ZYtkuMYx7UQAAhwa6FEDUa+ShXoUfK Cv1cCNslecadGnA+Zld2LZXyY4kbcg44zC1WfBhSPgor5HukxLp51JcQaiOxM9qEzAYL2iUcQVX GvtmV01juYnNBocQKFuTzMNQ7 X-Received: by 2002:a05:600c:13c3:b0:3e0:39:ec9d with SMTP id e3-20020a05600c13c300b003e00039ec9dmr667650wmg.23.1676891985217; Mon, 20 Feb 2023 03:19:45 -0800 (PST) X-Google-Smtp-Source: AK7set8gwoTHdOCWEVucXLZ1cWaezJA5lkFoQjhOhQbs8nj/fdafmDMVp3INR4+sjGhG9kWSgEqR2w== X-Received: by 2002:a05:600c:13c3:b0:3e0:39:ec9d with SMTP id e3-20020a05600c13c300b003e00039ec9dmr667628wmg.23.1676891984832; Mon, 20 Feb 2023 03:19:44 -0800 (PST) Received: from ?IPV6:2003:cb:c705:8300:e519:4218:a8b5:5bec? (p200300cbc7058300e5194218a8b55bec.dip0.t-ipconnect.de. [2003:cb:c705:8300:e519:4218:a8b5:5bec]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6405000000b002c5534db60bsm713917wru.71.2023.02.20.03.19.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Feb 2023 03:19:44 -0800 (PST) Message-ID: <77f5e061-080b-f9f0-25f7-bbbe721b5e2e@redhat.com> Date: Mon, 20 Feb 2023 12:19:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: Re: [PATCH v6 11/41] mm: Introduce pte_mkwrite_kernel() Content-Language: en-US To: Rick Edgecombe , 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, debug@rivosinc.com Cc: linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, xen-devel@lists.xenproject.org References: <20230218211433.26859-1-rick.p.edgecombe@intel.com> <20230218211433.26859-12-rick.p.edgecombe@intel.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20230218211433.26859-12-rick.p.edgecombe@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18.02.23 22:14, 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: David Hildenbrand Do we also have to care about pmd_mkwrite() ? -- Thanks, David / dhildenb 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44125C636CC for ; Mon, 20 Feb 2023 11:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pPK6cfOvsju2uZP6qhswPnHY/RGKKwXBS98+0+86/w0=; b=BRtWeKbI9HfqmT 2jC/Hv5Dc973mXcOy3KzLgUhNXE+zr/ANJXW57RevVlhlGrxNlr3+eko1nw+Fd5xEVFzIQXGE1wUH VYUvO2HkI6bAC30iQp009nGtYmr+0YTvamVKKEI6ZsfKP19KJZXQ90xuUuuuWxS161bD4o7wFOXbr kLLMo6Cxf7albApYfv4SMC7nQLdWGC0ywkIq1vv6NgWTx89rBfYX0kiQ8gOGfzAkWXk2D+wp8mPHy /1yJtr+oXX0kq0YzP9Jf0/zz1i155ZSt2n/qnESq+LzrD54aRVQhWpWFsfF+DubKbTfrIjLqExDJX Ilb7OaazGhty7b7sXEXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pU4EB-003pen-Ni; Mon, 20 Feb 2023 11:21:04 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pU4Cy-003owU-F1 for linux-arm-kernel@lists.infradead.org; Mon, 20 Feb 2023 11:19:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676891987; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4Y0d/vI0Qp2mhR9IQ+0FEQIh8Qkf0r9E2FFAh9KN8Lg=; b=SnD3OxKHIAk39zwowbiV9/1S027SKew+gek9VljiPPVLtnSnMXyozFMNg77hehg9IHDDqw f97+8wKgJqW5rCs3WCwq+I65MYTfXQhr+St+YTB+Ue4oD5yc4sgVFY2zbU6tgwkqvMKVeI rKebOasRafFU3IR4JIhcGhP08HfATpw= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-416-6aE7tjSOO8SVWliRg0FA6g-1; Mon, 20 Feb 2023 06:19:46 -0500 X-MC-Unique: 6aE7tjSOO8SVWliRg0FA6g-1 Received: by mail-wm1-f72.google.com with SMTP id k10-20020a05600c1c8a00b003dc55dcb298so563523wms.8 for ; Mon, 20 Feb 2023 03:19:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4Y0d/vI0Qp2mhR9IQ+0FEQIh8Qkf0r9E2FFAh9KN8Lg=; b=2lTa3egXOQy5eUUjbDVBP1jFa/yg6eMaYtALCupB5ymsrMTl/dD9EA/Q6j9hXYu2bf BNhohZ9smPm1j61kpkkHJJ4QX9rHTePZPjsC7BVF5hb+3eXL9BTeTxw+g2wBXMfZZSAr ywLNHnHOVJbJ07QsQHtSYkRDScZ5H9R6MRUJGG2DOU1YMJe71UNQWR71XfG9T7SA4bxh +c0Mijx3A3WUvnvJTxSFeqqVqrziOawsZSBmhZhFFP7a3NT09CKpqIpdgMjIXLpHhmFf UqmtG/2I+4K1Drhi7q09obeleQhL/nhA/oqm7zvoFthy1fLRGwY6HTvYoMRHZfcODrku x3Gg== X-Gm-Message-State: AO0yUKWllkohiqydRFzY2/cKLePEqOS28EST8UrsPVOuRMlBs1z2LjBT OhV0xGWwrRKHeelKD++73920fOOJKhv2FMyvEtZfKbWBe+xC4bUEhxT5Mr6qvnFAhqjDE0EwqwB UIbCp3s5xMIe/uZarK8KvZYEeDxTBIRrJkio= X-Received: by 2002:a05:600c:13c3:b0:3e0:39:ec9d with SMTP id e3-20020a05600c13c300b003e00039ec9dmr667676wmg.23.1676891985220; Mon, 20 Feb 2023 03:19:45 -0800 (PST) X-Google-Smtp-Source: AK7set8gwoTHdOCWEVucXLZ1cWaezJA5lkFoQjhOhQbs8nj/fdafmDMVp3INR4+sjGhG9kWSgEqR2w== X-Received: by 2002:a05:600c:13c3:b0:3e0:39:ec9d with SMTP id e3-20020a05600c13c300b003e00039ec9dmr667628wmg.23.1676891984832; Mon, 20 Feb 2023 03:19:44 -0800 (PST) Received: from ?IPV6:2003:cb:c705:8300:e519:4218:a8b5:5bec? (p200300cbc7058300e5194218a8b55bec.dip0.t-ipconnect.de. [2003:cb:c705:8300:e519:4218:a8b5:5bec]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6405000000b002c5534db60bsm713917wru.71.2023.02.20.03.19.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Feb 2023 03:19:44 -0800 (PST) Message-ID: <77f5e061-080b-f9f0-25f7-bbbe721b5e2e@redhat.com> Date: Mon, 20 Feb 2023 12:19:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: Re: [PATCH v6 11/41] mm: Introduce pte_mkwrite_kernel() To: Rick Edgecombe , 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, debug@rivosinc.com Cc: linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, xen-devel@lists.xenproject.org References: <20230218211433.26859-1-rick.p.edgecombe@intel.com> <20230218211433.26859-12-rick.p.edgecombe@intel.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20230218211433.26859-12-rick.p.edgecombe@intel.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230220_031948_681639_9D207E19 X-CRM114-Status: GOOD ( 20.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 18.02.23 22:14, 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: David Hildenbrand Do we also have to care about pmd_mkwrite() ? -- Thanks, David / dhildenb _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel