Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH] rv: Fix empty tail container detection
@ 2026-11-16  8:45 Avi Weiss
  2026-11-23 14:43 ` Gabriele Monaco
  0 siblings, 1 reply; 2+ messages in thread
From: Avi Weiss @ 2026-11-16  8:45 UTC (permalink / raw)
  To: rostedt, gmonaco
  Cc: mhiramat, mathieu.desnoyers, linux-trace-kernel, linux-kernel,
	Avi Weiss

rv_is_container_monitor() returns false for the last list entry
before checking its enable callback. With CONFIG_RV_MON_DEADLINE=y
and CONFIG_RV_MON_NOMISS=n, the empty deadline container can be
last. Enabling it then calls a NULL callback through
rv_enable_single(), causing a kernel oops.

An empty non-tail container already enables successfully: it is
marked enabled without activating any child monitors. Preserve this
behavior regardless of list position by checking the tail entry's
enable callback. Keep the tail check before list_next_entry() to
avoid accessing the list head as a monitor.

Fixes: 8d7861ac507d ("rv: Fix out-of-bound memory access in rv_is_container_monitor()")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 kernel/trace/rv/rv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
index 29f155c6968b..a142e877e940 100644
--- a/kernel/trace/rv/rv.c
+++ b/kernel/trace/rv/rv.c
@@ -222,7 +222,7 @@ bool rv_is_container_monitor(struct rv_monitor *mon)
 	struct rv_monitor *next;
 
 	if (list_is_last(&mon->list, &rv_monitors_list))
-		return false;
+		return !mon->enable;
 
 	next = list_next_entry(mon, list);
 

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.53.0


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

* Re: [PATCH] rv: Fix empty tail container detection
  2026-11-16  8:45 [PATCH] rv: Fix empty tail container detection Avi Weiss
@ 2026-11-23 14:43 ` Gabriele Monaco
  0 siblings, 0 replies; 2+ messages in thread
From: Gabriele Monaco @ 2026-11-23 14:43 UTC (permalink / raw)
  To: Avi Weiss, rostedt
  Cc: mhiramat, mathieu.desnoyers, linux-trace-kernel, linux-kernel

On Mon, 2026-11-16 at 10:45 +0200, Avi Weiss wrote:
> rv_is_container_monitor() returns false for the last list entry
> before checking its enable callback. With CONFIG_RV_MON_DEADLINE=y
> and CONFIG_RV_MON_NOMISS=n, the empty deadline container can be
> last. Enabling it then calls a NULL callback through
> rv_enable_single(), causing a kernel oops.
> 
> An empty non-tail container already enables successfully: it is
> marked enabled without activating any child monitors. Preserve this
> behavior regardless of list position by checking the tail entry's
> enable callback. Keep the tail check before list_next_entry() to
> avoid accessing the list head as a monitor.
> 
> Fixes: 8d7861ac507d ("rv: Fix out-of-bound memory access in
> rv_is_container_monitor()")
> Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
> ---

Well, this is not really a supported configuration, but since we can't easily
block it in KConfig and your change is neat and simple, it's still a good
addition, thanks.

Acked-by: Gabriele Monaco <gmonaco@redhat.com>

>  kernel/trace/rv/rv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
> index 29f155c6968b..a142e877e940 100644
> --- a/kernel/trace/rv/rv.c
> +++ b/kernel/trace/rv/rv.c
> @@ -222,7 +222,7 @@ bool rv_is_container_monitor(struct rv_monitor *mon)
>  	struct rv_monitor *next;
>  
>  	if (list_is_last(&mon->list, &rv_monitors_list))
> -		return false;
> +		return !mon->enable;
>  
>  	next = list_next_entry(mon, list);
>  
> 
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4


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

end of thread, other threads:[~2026-11-23 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16  8:45 [PATCH] rv: Fix empty tail container detection Avi Weiss
2026-11-23 14:43 ` Gabriele Monaco

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