Linux Trace Kernel
 help / color / mirror / Atom feed
* [RFC PATCH v2 42/43] tracing: Use PAGE_SIZE_MIN/MAX in the uprobe check and undefsyms page
       [not found] <20261201015240.1017259-1-ericcurtin17@gmail.com>
@ 2026-12-01  1:52 ` Eric Curtin
  0 siblings, 0 replies; only message in thread
From: Eric Curtin @ 2026-12-01  1:52 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Eric Curtin, Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
	linux-kernel, linux-trace-kernel

From: Eric Curtin <eric.curtin@docker.com>

With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot be used in BUILD_BUG_ON() or as an array size or
alignment.

In trace_uprobe.c, MAX_UCB_BUFFER_SIZE is PAGE_SIZE, so the build check
against MAX_PROBE_EVENT_SIZE now uses PAGE_SIZE_MIN directly. In
undefsyms_base.c, size and align the static page[] with PAGE_SIZE_MAX;
the memset() keeps using the run-time PAGE_SIZE.

No functional change for compile-time page sizes.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
(cherry picked from commit f68b4569af533a62d3da83ffb3141256868d1c70)
---
 kernel/trace/trace_uprobe.c   | 2 +-
 kernel/trace/undefsyms_base.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index fb7991543db7..d7ae99294bd0 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -1019,7 +1019,7 @@ static struct uprobe_cpu_buffer *prepare_uprobe_buffer(struct trace_uprobe *tu,
 	ucb = uprobe_buffer_get();
 	ucb->dsize = tu->tp.size + dsize;
 
-	BUILD_BUG_ON(MAX_UCB_BUFFER_SIZE < MAX_PROBE_EVENT_SIZE);
+	BUILD_BUG_ON(PAGE_SIZE_MIN < MAX_PROBE_EVENT_SIZE);
 	if (WARN_ON_ONCE(ucb->dsize > MAX_UCB_BUFFER_SIZE)) {
 		ucb->dsize = MAX_UCB_BUFFER_SIZE;
 		dsize = MAX_UCB_BUFFER_SIZE - tu->tp.size;
diff --git a/kernel/trace/undefsyms_base.c b/kernel/trace/undefsyms_base.c
index 37310baf706b..01b4f1913d61 100644
--- a/kernel/trace/undefsyms_base.c
+++ b/kernel/trace/undefsyms_base.c
@@ -14,13 +14,14 @@
 
 void undefsyms_base(void *p, int n);
 
-static char page[PAGE_SIZE] __aligned(PAGE_SIZE);
+static char page[PAGE_SIZE_MAX] __aligned(PAGE_SIZE_MAX);
 
 void undefsyms_base(void *p, int n)
 {
 	char buffer[256] = { 0 };
 	u32 u = 0;
 
+	/* PAGE_SIZE may be a variable, which the hypervisor provides */
 	memset((char * volatile)page, 8, PAGE_SIZE);
 	memset((char * volatile)buffer, 8, sizeof(buffer));
 	memcpy((void * volatile)p, buffer, sizeof(buffer));

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-01  1:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261201015240.1017259-1-ericcurtin17@gmail.com>
2026-12-01  1:52 ` [RFC PATCH v2 42/43] tracing: Use PAGE_SIZE_MIN/MAX in the uprobe check and undefsyms page Eric Curtin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox