Skip to contentSkip to conversation

tracing/probes: Ensure the uprobe buffer size is bigger than event size

PATCH New Masami Hiramatsu (Google) 1 participant 1 message May 11 Tracing

lore
Share & tools
lore

Masami Hiramatsu (Google)

author maintainer
#0 lore raw

PATCH 1/1 tracing/probes: Ensure the uprobe buffer size is bigger than event size

From: Masami Hiramatsu (Google) <[email protected]>

Add BUILD_BUG_ON() to ensure the uprobe per-CPU working buffer size is bigger than the event size.

---
 kernel/trace/trace_uprobe.c |    1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_uprobe.c +1 -0
index 2cabf8a23ec5..c5ee7920dec6 100644
@@ -979,6 +979,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);
 	if (WARN_ON_ONCE(ucb->dsize > MAX_UCB_BUFFER_SIZE)) {
 		ucb->dsize = MAX_UCB_BUFFER_SIZE;
 		dsize = MAX_UCB_BUFFER_SIZE - tu->tp.size;