]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tracing/probes: Ensure the uprobe buffer size is bigger than event size
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Mon, 1 Jun 2026 14:35:21 +0000 (23:35 +0900)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Mon, 1 Jun 2026 14:35:21 +0000 (23:35 +0900)
Add BUILD_BUG_ON() to ensure the uprobe per-CPU working buffer
size is bigger than the event size.

Link: https://lore.kernel.org/all/177849383209.8038.1902170479780501237.stgit@devnote2/
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
kernel/trace/trace_uprobe.c

index 2cabf8a23ec5c83f230e1330fc04dc3aa8b50379..c5ee7920dec6379c77a788b8c9d0988376816a46 100644 (file)
@@ -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;