Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1161128rwd; Tue, 13 Jun 2023 05:51:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ60Zh5ROd74nA5dALzCqyHGOryIDCaD5c8knNiyKTX3eKgzOBP0zmBwQkv19PpECrofD3/v X-Received: by 2002:a05:6402:2747:b0:516:5b18:a9f1 with SMTP id z7-20020a056402274700b005165b18a9f1mr10102962edd.0.1686660671069; Tue, 13 Jun 2023 05:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686660671; cv=none; d=google.com; s=arc-20160816; b=Yo0osohdFH0y5YvweuN6e4Buux20YzTCkcM9m/d+WXqrcahTvRZ8fJP8UWouXMszRf FV+h5DomIHI54zQ3r1R7QT1bVNCpXICWRN1gAZILUlKJAJoflYCawLKKfIU7/biVEenV haJatvVpxAE+VD2fcTZSkJ87vNOPWmlIKPHh/YAsjb/EgxSG3mj5W2H68EZc9DJp3e9s 3l6gAFqLTrzbUD4evIXfgfcUWYPSAaZ6RN6OYDpBfvq1b0fzqQgXhbOwKZoh1gjQEXYG tpIEEBiA1n3iLp+jS7bNVcGxMnqyW3aVnPqerAw8b5SH7gRpPlEbpR+QgOKNaYuGwdVM Iz6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=5APAgmZrGjFJ9+U0RvJUaGvdr2gWc6sxi+r6310cnNs=; b=ThEIduAIvhV5086Irl2qZ5e0VrqP4yHJnvcp2IsNOHrUZ6IHjwRgcTgMvJ+YEUhB7z UWS+gjD5pp/mU4heddntDTZGCoQ61nWzAOp7R8CHTtpaSjTKIVPl9u2brxtFpNf/oOyt 9zQRy/gnVpVgwIThCRrH8Kp/UxQzuiVCkKFttu0QAK3j94xp6v27dWz5XGVFIPVQRx5s IQCSAWtbu9YffFrOfbgr9zlDJC56YY2FbOVTj3CQw6ziSiiAzzBy4sY9VkvCx6Vxvpk4 D9q7GYQ0kZMOn6MnSASHHUspGdnxBYhB/Vb4BPi1zVqyuP+DduEHzvHNs6juXqF6X7QH K56Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NpemX1oc; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020aa7d410000000b00516af4a2e8asi7339126edq.290.2023.06.13.05.50.46; Tue, 13 Jun 2023 05:51:11 -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=@redhat.com header.s=mimecast20190719 header.b=NpemX1oc; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242475AbjFMM3j (ORCPT + 99 others); Tue, 13 Jun 2023 08:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242474AbjFMM3O (ORCPT ); Tue, 13 Jun 2023 08:29:14 -0400 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 291D7173E for ; Tue, 13 Jun 2023 05:28:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686659298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5APAgmZrGjFJ9+U0RvJUaGvdr2gWc6sxi+r6310cnNs=; b=NpemX1ocFWDM1Jmyz+nrK9ZpYU08wE6iscEdj7w6KetAsPrCRPOR33uj2YzQ+NGDI9xFxG ofMbFgb7TFJdjLQXR1lYykQMCz2ht40lWsGpbzukhJ1tg5tLu5Plik83oCOioTshUpSdnP ahg0K99Jrlx1aaB+llVMNNOx/TmtlU0= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-515-O614FytmNMmlZX5Pk76c_w-1; Tue, 13 Jun 2023 08:28:17 -0400 X-MC-Unique: O614FytmNMmlZX5Pk76c_w-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-30fc9cfe82eso580173f8f.1 for ; Tue, 13 Jun 2023 05:28:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686659296; x=1689251296; h=content-transfer-encoding:in-reply-to:organization:from:references :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=5APAgmZrGjFJ9+U0RvJUaGvdr2gWc6sxi+r6310cnNs=; b=dEJ9s+qVflN8YRcZ8kjGvnVRahA01NK/l67pjK2PId8aUM/gyE0nmiN2z+z4MohVtG Uqm+TbI55aH9w5GxBApdRE1qZEe/1SXDC1Jkf5bQsxRIN71tghC74KLmP3G2x2HBcSvw QB9y3Z1jncnQtodl6U9JCJ2ygxZXJCePLIFsxruxkOtWI7iwi5UfX28vrxZ0PVdweHzj gqFM0gNz4LRlCdkR8jCjwNgTCYmbn/6MCChygXpUpp3m++FKsOzgbUKSL70nU3hPk2xA cF54SxcJwrZ47uEU203hvBA5XzRp7WMW6YnG1yAxFm69BBil3OmP6OMU36bUtnJBFqpG 8gpg== X-Gm-Message-State: AC+VfDwUeLXbspLoGlTZbxiNdKJUth0qzrp05G1zOyQ2Dm9Zkve4bmRo Rr4uo+vLL/LqqWUkazI2ZUWO7i0mB1Rd4tzlfh/lF5IWIcNDtT/yy+r4e3+BkZgpRHNuT8GEhuK /F7pJ6q3+RJX/r5wXyAywrUi1 X-Received: by 2002:a05:6000:10c7:b0:30a:eae0:106c with SMTP id b7-20020a05600010c700b0030aeae0106cmr7102033wrx.10.1686659296206; Tue, 13 Jun 2023 05:28:16 -0700 (PDT) X-Received: by 2002:a05:6000:10c7:b0:30a:eae0:106c with SMTP id b7-20020a05600010c700b0030aeae0106cmr7101998wrx.10.1686659295754; Tue, 13 Jun 2023 05:28:15 -0700 (PDT) Received: from ?IPV6:2003:cb:c710:ff00:1a06:80f:733a:e8c6? (p200300cbc710ff001a06080f733ae8c6.dip0.t-ipconnect.de. [2003:cb:c710:ff00:1a06:80f:733a:e8c6]) by smtp.gmail.com with ESMTPSA id u2-20020a5d4342000000b0030e5c8d55f2sm15258101wrr.6.2023.06.13.05.28.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jun 2023 05:28:15 -0700 (PDT) Message-ID: <65805965-c6a2-ce0c-fb11-5277e5976120@redhat.com> Date: Tue, 13 Jun 2023 14:28:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v9 03/42] mm: Make pte_mkwrite() take a VMA 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, szabolcs.nagy@arm.com, torvalds@linux-foundation.org, broonie@kernel.org References: <20230613001108.3040476-1-rick.p.edgecombe@intel.com> <20230613001108.3040476-4-rick.p.edgecombe@intel.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20230613001108.3040476-4-rick.p.edgecombe@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 13.06.23 02:10, Rick Edgecombe wrote: > The x86 Shadow stack 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 unusual properties is that shadow stack memory is writable, > but only in limited ways. These limits are applied via a specific PTE > bit combination. Nevertheless, the memory is writable, and core mm code > will need to apply the writable permissions in the typical paths that > call pte_mkwrite(). Future patches will make pte_mkwrite() take a VMA, so > that the x86 implementation of it can know whether to create regular > writable memory or shadow stack memory. > > But there are a couple of challenges to this. Modifying the signatures of > each arch pte_mkwrite() implementation would be error prone because some > are generated with macros and would need to be re-implemented. Also, some > pte_mkwrite() callers operate on kernel memory without a VMA. > > So this can be done in a three step process. First pte_mkwrite() can be > renamed to pte_mkwrite_novma() in each arch, with a generic pte_mkwrite() > added that just calls pte_mkwrite_novma(). Next callers without a VMA can > be moved to pte_mkwrite_novma(). And lastly, pte_mkwrite() and all callers > can be changed to take/pass a VMA. > > In a previous patches, pte_mkwrite() was renamed pte_mkwrite_novma() and > callers that don't have a VMA were changed to use pte_mkwrite_novma(). So > now change pte_mkwrite() to take a VMA and change the remaining callers to > pass a VMA. Apply the same changes for pmd_mkwrite(). > > No functional change. > > Suggested-by: David Hildenbrand > Signed-off-by: Rick Edgecombe > --- Acked-by: David Hildenbrand Hopefully we'll get this landed soon :) -- Cheers, David / dhildenb