Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH] tracing/osnoise: reject a zero sample runtime
@ 2026-12-03 16:44 Kyuwon Cho
  2026-12-03 17:33 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Kyuwon Cho @ 2026-12-03 16:44 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Daniel Bristot de Oliveira,
	linux-kernel, linux-trace-kernel

The osnoise runtime parameter accepts zero, allowing the tracer to emit a
sample whose runtime is zero. Reading that sample from trace divides the
available CPU time by the zero runtime in trace_osnoise_print().

Set the runtime parameter minimum to one microsecond so every emitted
sample has a valid denominator.

Fixes: bce29ac9ce0b ("trace: Add osnoise tracer")
Signed-off-by: Kyuwon Cho <kyuwon.cho@skku.edu>
---
The issue was found by an LLM-guided test generator that we are
developing as a research prototype.

The reproducer mounts tracefs, writes zero to osnoise/runtime_us, enables
the osnoise tracer, and reads its trace. Access to tracefs requires root
in the initial namespace.

The decoded trace is:

  Oops: divide error: 0000 [#1] SMP KASAN NOPTI
  RIP: 0010:trace_osnoise_print (kernel/trace/trace_output.c:1601)
  Call Trace:
   print_trace_line (kernel/trace/trace.c:3090 kernel/trace/trace.c:3256)
   seq_read_iter (fs/seq_file.c:273)
   seq_read (fs/seq_file.c:163)
   vfs_read (fs/read_write.c:552)

The patch was tested on v7.4-rc5 and rebased onto tracing commit
175e5f3eddc6 ("tracing: Use test_bit() in event_enable_count_probe()").

 kernel/trace/trace_osnoise.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index fbba42286747..f0af4133a506 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -2648,11 +2648,13 @@ static int timerlat_fd_release(struct inode *inode, struct file *file)
 /*
  * osnoise/runtime_us: cannot be greater than the period.
  */
+static u64 osnoise_min_runtime = 1;
+
 static struct trace_min_max_param osnoise_runtime = {
 	.lock	= &interface_lock,
 	.val	= &osnoise_data.sample_runtime,
 	.max	= &osnoise_data.sample_period,
-	.min	= NULL,
+	.min	= &osnoise_min_runtime,
 };
 
 /*
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-03 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 16:44 [PATCH] tracing/osnoise: reject a zero sample runtime Kyuwon Cho
2026-12-03 17:33 ` sashiko-bot

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