All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb+git@google.com>
To: linux-kernel@vger.kernel.org
Cc: "Ard Biesheuvel" <ardb@kernel.org>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Petr Pavlu" <petr.pavlu@suse.com>,
	"Daniel Gomez" <da.gomez@kernel.org>,
	"Sami Tolvanen" <samitolvanen@google.com>,
	"Aaron Tomlin" <atomlin@atomlin.com>,
	"Adrian Barnaś" <abarnas@google.com>,
	"Ryan Roberts" <ryan.roberts@arm.com>,
	"Kevin Brodsky" <kevin.brodsky@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-modules@vger.kernel.org
Subject: [RFC PATCH 6/9] arm64: Enable the execmem ROX cache for module text
Date: Sat, 22 Aug 2026 15:53:28 +0200	[thread overview]
Message-ID: <20260822135323.795946-17-ardb+git@google.com> (raw)
In-Reply-To: <20260822135323.795946-11-ardb+git@google.com>

From: Ard Biesheuvel <ardb@kernel.org>

Wire up the existing support for the execmem ROX cache on arm64, so that
it will be used for module .text and .init.text regions. This will be
relied upon by a subsequent patch in order to allocate those regions
from a single chunk of memory.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/arm64/Kconfig   |  1 +
 arch/arm64/mm/init.c | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index b3afe0688919..080b97b0bbd5 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -27,6 +27,7 @@ config ARM64
 	select ARCH_HAS_DMA_OPS if XEN
 	select ARCH_HAS_DMA_PREP_COHERENT
 	select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
+	select ARCH_HAS_EXECMEM_ROX
 	select ARCH_HAS_FAST_MULTIPLIER
 	select ARCH_HAS_FORTIFY_SOURCE
 	select ARCH_HAS_GCOV_PROFILE_ALL
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 97987f850a33..e6c98045046e 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -531,7 +531,8 @@ struct execmem_info __init *execmem_arch_setup(void)
 			[EXECMEM_DEFAULT] = {
 				.start	= start,
 				.end	= end,
-				.pgprot	= PAGE_KERNEL,
+				.pgprot	= PAGE_KERNEL_ROX,
+				.flags	= EXECMEM_ROX_CACHE,
 				.alignment = 1,
 				.fallback_start	= fallback_start,
 				.fallback_end	= fallback_end,
@@ -548,9 +549,25 @@ struct execmem_info __init *execmem_arch_setup(void)
 				.pgprot	= PAGE_KERNEL,
 				.alignment = 1,
 			},
+			[EXECMEM_MODULE_DATA] = {
+				.start	= start,
+				.end	= end,
+				.pgprot	= PAGE_KERNEL,
+				.alignment = 1,
+				.fallback_start	= fallback_start,
+				.fallback_end	= fallback_end,
+			},
 		},
 	};
 
+	if (!system_supports_bbml2_noabort())
+		execmem_info.ranges[EXECMEM_DEFAULT].flags |= EXECMEM_NO_HUGE_VMAP;
+
 	return &execmem_info;
 }
+
+void execmem_fill_trapping_insns(void *ptr, size_t size)
+{
+	memset32(ptr, AARCH64_BREAK_FAULT, size / sizeof(__le32));
+}
 #endif /* CONFIG_EXECMEM */
-- 
2.55.0.860.g4b6b3295ed-goog


  parent reply	other threads:[~2026-08-22 13:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22 13:53 [RFC PATCH 0/9] arm64: Allocate .text and .init.text together Ard Biesheuvel
2026-08-22 13:53 ` [RFC PATCH 1/9] mm: execmem: Add API to split an existing execmem cache allocation Ard Biesheuvel
2026-08-22 13:53 ` [RFC PATCH 2/9] mm: execmem: Allow huge vmappings to be avoided for execmem caches Ard Biesheuvel
2026-08-22 14:10   ` sashiko-bot
2026-08-22 13:53 ` [RFC PATCH 3/9] module: Place MOD_TEXT before MOD_INIT_TEXT in enumeration Ard Biesheuvel
2026-08-22 14:05   ` sashiko-bot
2026-08-22 13:53 ` [RFC PATCH 4/9] module: Allocate MOD_INIT_TEXT from the MOD_TEXT ROX allocation Ard Biesheuvel
2026-08-28 14:11   ` Bradley Morgan
2026-08-22 13:53 ` [RFC PATCH 5/9] arm64: mm: Permit permissions changes on huge vmappings Ard Biesheuvel
2026-08-22 14:10   ` sashiko-bot
2026-08-23 16:52   ` Adrian Barnaś
2026-08-22 13:53 ` Ard Biesheuvel [this message]
2026-08-22 14:13   ` [RFC PATCH 6/9] arm64: Enable the execmem ROX cache for module text sashiko-bot
2026-08-23 16:46   ` Adrian Barnaś
2026-08-22 13:53 ` [RFC PATCH 7/9] arm64: ftrace: Revert "fix unreachable PLT for ftrace_caller ..." Ard Biesheuvel
2026-08-22 13:53 ` [RFC PATCH 8/9] arm64: module: Combine init and core PLT entries again Ard Biesheuvel
2026-08-22 14:12   ` sashiko-bot
2026-08-22 13:53 ` [RFC PATCH 9/9] arm64: ftrace: Simplify PLT handling Ard Biesheuvel
2026-08-28 13:07 ` [RFC PATCH 0/9] arm64: Allocate .text and .init.text together Petr Pavlu
2026-08-28 13:45   ` Ard Biesheuvel
2026-08-31 13:30     ` Petr Pavlu
2026-09-02 17:23 ` Mike Rapoport

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260822135323.795946-17-ardb+git@google.com \
    --to=ardb+git@google.com \
    --cc=abarnas@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=atomlin@atomlin.com \
    --cc=catalin.marinas@arm.com \
    --cc=da.gomez@kernel.org \
    --cc=kevin.brodsky@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mcgrof@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=petr.pavlu@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=samitolvanen@google.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.