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 59901C77B7A for ; Tue, 13 Jun 2023 07:45:39 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UTIEoAnSVw9g5VtvEi5c0gG/yIvVwCgjViKq+rht9Ys=; b=BgtyllMHPjtFY3 L0B3qVTgLd6/RlDjUUDwlsP2ubIF/U9EHqWTUvnXjVhIzYFWbRCtoqcF4UL1cirDB0GbWb+K/DCV0 5gpEVvqi+UvDyCRfH7Nz6yF0NXZhQVBNmtTE4gfMq8LHr2Q7Nbq1JelRsz5u4dp77It1M5zDkgqPb Do4VFiBIdMXnKM0FgjIFuX1il9m6anOfwLx8eev7y4BI4SBnfJMYlUxmvnhpf93FoWbAshegxm6vQ H8Tia+Frppg3kaJ7dYCdkoxgNqqgZ85PZxQl6UnK5lCFN23AKWZKWUsV0fE8WJZo5IQng4Igy567l /T4ThVPOq4vi8O56aEAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8yiG-007G98-0c; Tue, 13 Jun 2023 07:45:12 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q8yiC-007G7I-2a for linux-arm-kernel@lists.infradead.org; Tue, 13 Jun 2023 07:45:10 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5850B61A47; Tue, 13 Jun 2023 07:45:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 089C9C433D2; Tue, 13 Jun 2023 07:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686642307; bh=f4w4+2Npq1dkMitUJV0S3ITs/vGEti03A0AefRWYLBE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DAQB2NbikRdiWHwMApaPAIzaTY/w5HN4Xf7lKIGhQ1CWk0NWLGkjAYZnVQ2Z/26E5 Gj6fP0pEbtlpdHh+jAjgE6Pt3fChamJqEF8aVQsamsvQWLvQ+me4hgKoCdbO2U9n0H sLhdxmmB9s+aWXDyuT2lGzl1ZVFe+wKqtDoS4hK67cKlfHnfx6dLaBFlaN8NreyThe AbwFvqwokH5jRmekfEWGpgdCqyPUEmoq/Gm4fiWKIVNatWddBhbTkdXtpDdl7j7Ve/ HOLkc/hxxqb1vXEgvy7sHCTE8mCUAdXBvfqxYV+N5P2bD908YKbA9glKAU7xQzQvwR geNzoGQaAeXIA== Date: Tue, 13 Jun 2023 10:44:28 +0300 From: Mike Rapoport 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, 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, szabolcs.nagy@arm.com, torvalds@linux-foundation.org, broonie@kernel.org, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, xen-devel@lists.xenproject.org Subject: Re: [PATCH v9 02/42] mm: Move pte/pmd_mkwrite() callers with no VMA to _novma() Message-ID: <20230613074428.GS52412@kernel.org> References: <20230613001108.3040476-1-rick.p.edgecombe@intel.com> <20230613001108.3040476-3-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230613001108.3040476-3-rick.p.edgecombe@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230613_004508_930216_00F420D2 X-CRM114-Status: GOOD ( 26.89 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 12, 2023 at 05:10:28PM -0700, 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. Nit: ^ mappings? > 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. > > Previous patches have done the first step, so next move the callers that > don't have a VMA to pte_mkwrite_novma(). Also do the same for I hear x86 maintainers asking to drop "previous patches" ;-) Maybe This is the second step of the conversion that moves the callers ... > pmd_mkwrite(). This will be ok for the shadow stack feature, as these > callers are on kernel memory which will not need to be made shadow stack, > and the other architectures only currently support one type of memory > in pte_mkwrite() > > 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 > Signed-off-by: Rick Edgecombe Reviewed-by: Mike Rapoport (IBM) -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel