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 2ECA2C7618E for ; Fri, 21 Apr 2023 07:53:06 +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=dABcPurN7f1CDbzcDEPkkj5hoEM5hI63cRYpCyVoeQw=; b=2NnI1FpOeSZV5J odjPTQ0GjUObKoywbuL9K069jAnsq5NMhvyeyM5nj4i9JCBNOCcCMsR94SuyPSfe3X1mfmWdm+el5 KjgiQ23/w4MHl9Jhkw6RI1bebHOO2M3nOJKHa464kkPEkHoSoIgN2cQJOfOT/hLFeEE2VoDKxXT6w pjtRios2rcGe7e+wuKNao4jhtW9mcQWxKuuDB+YflR0yZABtdtE6Te9eHiVSduFUCIpDWu/JMNcgf oB0NdBtU/HljuZ6T3sC1kQdbcKNPVfjy7cJEQl6wAO90Wq7ci1hYs1gGr1iY6xRvt5g4rvQKLrV5L USpUdah0UjWQSNVbaZoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pplZ2-00A1ZS-1Q; Fri, 21 Apr 2023 07:52:16 +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 1pplYz-00A1Yi-18 for linux-arm-kernel@lists.infradead.org; Fri, 21 Apr 2023 07:52:14 +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 D39F864E83; Fri, 21 Apr 2023 07:52:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70486C433D2; Fri, 21 Apr 2023 07:52:10 +0000 (UTC) Date: Fri, 21 Apr 2023 08:52:07 +0100 From: Catalin Marinas To: Joey Gouly Cc: linux-arm-kernel@lists.infradead.org, nd@arm.com, broonie@kernel.org, james.morse@arm.com, mark.rutland@arm.com, maz@kernel.org, oliver.upton@linux.dev, suzuki.poulose@arm.com, will@kernel.org, yuzenghui@huawei.com Subject: Re: [PATCH v2 11/19] arm64: add PTE_UXN/PTE_WRITE to SWAPPER_*_FLAGS Message-ID: References: <20230413110513.243326-1-joey.gouly@arm.com> <20230413110513.243326-12-joey.gouly@arm.com> <20230420152917.GA2499095@e124191.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230420152917.GA2499095@e124191.cambridge.arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230421_005213_425591_598AB052 X-CRM114-Status: GOOD ( 24.62 ) 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 Thu, Apr 20, 2023 at 04:29:17PM +0100, Joey Gouly wrote: > On Thu, Apr 13, 2023 at 05:35:15PM +0100, Catalin Marinas wrote: > > On Thu, Apr 13, 2023 at 12:05:05PM +0100, Joey Gouly wrote: > > > With PIE enabled, the swapper PTEs would have a Permission Indirection Index > > > (PIIndex) of 0. A PIIndex of 0 is not currently used by any other PTEs. > > > > > > To avoid using index 0 specifically for the swapper PTEs, mark them as > > > PTE_UXN and PTE_WRITE, so that they map to a PAGE_KERNEL_EXEC equivalent. > > > > > > Signed-off-by: Joey Gouly > > > Cc: Catalin Marinas > > > Cc: Will Deacon > > > Cc: Mark Rutland > > > --- > > > arch/arm64/include/asm/kernel-pgtable.h | 4 ++-- > > > arch/arm64/kernel/head.S | 8 ++++---- > > > arch/arm64/mm/proc.S | 2 +- > > > 3 files changed, 7 insertions(+), 7 deletions(-) > > > > > > diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h > > > index fcd14197756f..daf1909116f6 100644 > > > --- a/arch/arm64/include/asm/kernel-pgtable.h > > > +++ b/arch/arm64/include/asm/kernel-pgtable.h > > > @@ -104,8 +104,8 @@ > > > /* > > > * Initial memory map attributes. > > > */ > > > -#define SWAPPER_PTE_FLAGS (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED) > > > -#define SWAPPER_PMD_FLAGS (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S) > > > +#define SWAPPER_PTE_FLAGS (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED | PTE_UXN | PTE_WRITE) > > > +#define SWAPPER_PMD_FLAGS (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S | PTE_UXN | PTE_WRITE) > > > > I mentioned on the previous version, I think it's better not to add the > > PTE_WRITE here but in the users of these macros where writeable is > > required (e.g. SWAPPER_RX_MMUFLAGS doesn't need PTE_WRITE as it has > > PTE_RDONLY). > > I didn't ignore the previous comment, I just misunderstood it and thought I > should leave it as is. Yeah, sorry, my comment was confusing. > I've made the change now! Thanks. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel