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 93005CD1288 for ; Thu, 4 Apr 2024 00:49:49 +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:Mime-Version:References:In-Reply-To: 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=8F8uNEhnqX/XRiCXweOi2WnYBMqNojOlxwIZTXN3F4Q=; b=HssyTKfMscSNcW 4M3UVvKHRVGriLNRzJWhh2jPMIj/uwX4HfN5cckHGSMA1VM/jN/KP0z+8SJXTZrTCyF/30wmRNlZe juBxoozLtf2oZsebfOfeBuUYhy7ROF8BnwDNEUlJYFDZ0G2J8fqcLgNAZnNrRadkA0/aFxD+Ltpr5 kAQoJtaEwyoHHIIZxBXXfmEWJ1hS8wIPW848GrGxRmpafI8jwVVcFDR2OnPoIicXqx8GtpJuXBPfM +IMdiDLJtOmVnt58cQzGZPZrnQT0CyO67N/KLaZLPMpE9n7r2MBbURy9XlTlFZ0N0cHEjHlaKGkE+ MaynOnnF2BZSBS4oYkTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsBIN-00000000oSU-2If2; Thu, 04 Apr 2024 00:49:35 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsAHp-00000000c6j-1uXp for linux-arm-kernel@lists.infradead.org; Wed, 03 Apr 2024 23:45:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B73D961536; Wed, 3 Apr 2024 23:44:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27297C43390; Wed, 3 Apr 2024 23:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712187896; bh=km9WrjrljLnrGGBMhJMqtSVQkEOEoORatY4UgWPCrhI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RV7GYcjmC1peJ0K+6FY0qq/5hSfZCqUJ2QNUdpb36t3OAFaxi4FIhiRPOlfjWOmB+ /ud3+bqKCOc8B7qynP/pFR9M6i2xUeFZC2o5G/FIWr86jnalK6ebcSYxmezEfEAAwY qEzEr4Q/6wcwSKE6hfjU4gyCyoZQsyrTUL37YxInBx03Rvu/aGC3Dg7ddui9zju7zT u5HYDBHA4woR7MjA0UIH5lJ5bros70GI7v/Mv0q9sIrhKtnwgdp13v6VgBCR22I3rW SSV9EGak+zZhFFO3HON2I/X992RARtXhQdSsERIO7HiMey7dt6+AEbK8dqX8KTWxCm RitZLYXh9l5lQ== Date: Thu, 4 Apr 2024 08:44:50 +0900 From: Masami Hiramatsu (Google) To: Catalin Marinas Cc: Mark Rutland , linux-kernel@vger.kernel.org, Will Deacon , anil.s.keshavamurthy@intel.com, aou@eecs.berkeley.edu, davem@davemloft.net, jarkko@kernel.org, linux-arm-kernel@lists.infradead.org, mhiramat@kernel.org, naveen.n.rao@linux.ibm.com, palmer@dabbelt.com, paul.walmsley@sifive.com Subject: Re: [PATCH v2 1/4] arm64: patching: always use fixmap Message-Id: <20240404084450.802bae64e3ed08197fd0dad1@kernel.org> In-Reply-To: References: <20240403150154.667649-1-mark.rutland@arm.com> <20240403150154.667649-2-mark.rutland@arm.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240403_164457_827344_94A3E48D X-CRM114-Status: GOOD ( 26.34 ) 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 Wed, 3 Apr 2024 18:52:30 +0100 Catalin Marinas wrote: > On Wed, Apr 03, 2024 at 04:01:51PM +0100, Mark Rutland wrote: > > For historical reasons, patch_map() won't bother to fixmap non-image > > addresses when CONFIG_STRICT_MODULE_RWX=n, matching the behaviour prior > > to the introduction of CONFIG_STRICT_MODULE_RWX. However, as arm64 > > doesn't select CONFIG_ARCH_OPTIONAL_KERNEL_RWX, CONFIG_MODULES implies > > CONFIG_STRICT_MODULE_RWX, so any kernel built with module support will > > use the fixmap for any non-image address. > > > > Historically we only used patch_map() for the kernel image and modules, > > but these days its also used by BPF and KPROBES to write to read-only > > pages of executable text. Currently these both depend on CONFIG_MODULES, > > but we'd like to change that in subsequent patches, which will require > > using the fixmap regardless of CONFIG_STRICT_MODULE_RWX. > > > > This patch changes patch_map() to always use the fixmap, and simplifies > > the logic: > > > > * Use is_image_text() directly in the if-else, rather than using a > > temporary boolean variable. > > > > * Use offset_in_page() to get the offset within the mapping. > > > > * Remove uintaddr and cast the address directly when using > > is_image_text(). > > > > For kernels built with CONFIG_MODULES=y, there should be no functional > > change as a result of this patch. > > > > For kernels built with CONFIG_MODULES=n, patch_map() will use the fixmap > > for non-image addresses, but there are no extant users with non-image > > addresses when CONFIG_MODULES=n, and hence there should be no functional > > change as a result of this patch alone. > > > > Signed-off-by: Mark Rutland > > Cc: Catalin Marinas > > Cc: Will Deacon > > --- > > arch/arm64/kernel/patching.c | 10 +++------- > > 1 file changed, 3 insertions(+), 7 deletions(-) > > > > Catalin, Will, this is a prerequisite for the final two patches in the > > series. Are you happy for this go via the tracing tree? > > Fine by me. > > Acked-by: Catalin Marinas Thanks Catalin. I'll pick this series to linux-trace tree. Thank you! -- Masami Hiramatsu (Google) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel