From: sashiko-bot@kernel.org
To: "Valentin Schneider" <vschneid@redhat.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v5 7/8] rtla: Unconditionally clean any pre-existing filters for user-provided events
Date: Wed, 02 Sep 2026 13:44:12 +0000 [thread overview]
Message-ID: <20260902134412.943AD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902123942.695822-8-vschneid@redhat.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Medium] Logic error in command-line trigger processing causing triggers to accumulate instead of overriding.
- [Medium] Unconditionally clearing filters during event processing destroys previously configured specific event filters when a subsystem is enabled.
- [Medium] Out-of-bounds read in osnoise_ipi_cpumask_handler due to using glibc CPU_AND on a dynamically sized trace event field.
- [Medium] Missing bounds check on `dst_cpu` parsed from trace record leads to an out-of-bounds array write.
--
commit 5cb00dbb92aa356c89071b1755fbef9a7743360f
Author: Valentin Schneider <vschneid@redhat.com>
rtla: Unconditionally clean any pre-existing filters for user-provided events
This commit unconditionally cleans up pre-existing filters when enabling an
event provided via the '-e' command line argument to prevent confusion. It
also documents that when the same event is specified multiple times, only
the last specified filter or trigger applies.
> diff --git a/Documentation/tools/rtla/common_options.txt b/Documentation/tools/rtla/common_options.txt
> index 38da1cf443a48..6bf0f86393333 100644
> --- a/Documentation/tools/rtla/common_options.txt
> +++ b/Documentation/tools/rtla/common_options.txt
> @@ -26,12 +26,19 @@
>
> **--filter** *<filter>*
>
> - Filter the previous **-e** *sys:event* event with *<filter>*. For further information about event filtering see https://www.kernel.org/doc/html/latest/trace/events.html#event-filtering.
> + Filter the previous **-e** *sys:event* event with *<filter>*.
> +
> + If the same event is specified more than once but with different filters, the last specified filter will be the only one applied.
> +
> + For further information about event filtering see https://www.kernel.org/doc/html/latest/trace/events.html#event-filtering.
>
> This option cannot be unset.
>
> **--trigger** *<trigger>*
> Enable a trace event trigger to the previous **-e** *sys:event*.
> +
> + If the same event is specified more than once but with different triggers, the last specified trigger will be the only one applied.
> +
[Severity: Medium]
Does the command-line trigger processing actually implement this override
behavior?
Looking at trace_event_enable_trigger() in tools/tracing/rtla/src/trace.c,
the new trigger is written without clearing prior triggers for the same
event:
retval = tracefs_event_file_write(instance->inst, tevent->system,
tevent->event, "trigger", trigger);
Since tracefs 'trigger' files are cumulative by default, could this cause
triggers to accumulate instead of replacing the previous one?
> If the *hist:* trigger is activated, the output histogram will be automatically saved to a file named *system_event_hist.txt*.
> For example, the command:
>
> diff --git a/tools/tracing/rtla/src/trace.c b/tools/tracing/rtla/src/trace.c
> index 17d148f7d5d6e..06204d339f967 100644
> --- a/tools/tracing/rtla/src/trace.c
> +++ b/tools/tracing/rtla/src/trace.c
> @@ -487,6 +487,10 @@ static int trace_event_enable_filter(struct trace_instance *instance,
> char filter[MAX_PATH];
> int retval;
>
> + /* Unconditionally clean any pre-existing filters */
> + tracefs_event_file_write(instance->inst, tevent->system,
> + tevent->event, "filter", "0");
> +
[Severity: Medium]
Will this destroy previously configured specific event filters when a broader
subsystem is enabled?
If tevent->event is NULL (e.g., when enabling an entire subsystem like
'-e sched'), unconditionally writing '0' to the subsystem's filter file
might wipe out all specific event filters previously configured within
that subsystem.
> if (!tevent->filter)
> return 0;
>
While reviewing this series, I also noticed a couple of issues introduced
in osnoise_top.c:
[Severity: Medium]
Does osnoise_ipi_cpumask_handler() have an out-of-bounds read when parsing
the cpumask field?
When processing a broadcast IPI trace event, the dynamically sized 'cpumask'
field is extracted into event_cpus:
tools/tracing/rtla/src/osnoise_top.c:osnoise_ipi_cpumask_handler() {
...
event_cpus = tep_get_field_raw(s, event, "cpumask", record, &len, 1);
...
CPU_AND(&cpumask_tmp_cpus, event_cpus, ¶ms->common.monitored_cpus);
...
}
Since glibc's CPU_AND() unconditionally reads 128 bytes (sizeof(cpu_set_t))
from event_cpus, and the raw buffer size is only 'len' bytes, could this
read past the end of the buffer?
[Severity: Medium]
Is there a missing bounds check on dst_cpu in osnoise_ipi_cpu_handler()
that could lead to an out-of-bounds write?
The 'cpu' field is parsed from the trace record directly into dst_cpu and
used as an array index:
tools/tracing/rtla/src/osnoise_top.c:osnoise_ipi_cpu_handler() {
...
tep_get_field_val(s, event, "cpu", record, &dst_cpu, 1);
account_ipi(tool, dst_cpu);
...
}
tools/tracing/rtla/src/osnoise_top.c:account_ipi() {
...
cpu_data = &data->cpu_data[dst_cpu];
update_sum(&cpu_data->ipi_count, &inc);
...
}
If the trace record contains an unexpectedly high CPU ID (e.g., due to hotplug
or trace buffer corruption), could this write beyond the bounds of the
data->cpu_data array since there's no verification that dst_cpu < nr_cpus?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260902123942.695822-1-vschneid@redhat.com?part=7
next prev parent reply other threads:[~2026-09-02 13:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 12:39 [PATCH v5 0/8] tracing/osnoise: Track IPIs Valentin Schneider
2026-09-02 12:39 ` [PATCH v5 1/8] rtla/osnoise: Add IPI tracking cmdline option Valentin Schneider
2026-09-02 12:39 ` [PATCH v5 2/8] rtla/osnoise: Record IPI count in osnoise top Valentin Schneider
2026-09-02 13:01 ` sashiko-bot
2026-09-02 12:39 ` [PATCH v5 3/8] rtla/osnoise: Leverage IPI event filters when tracing a subset of CPUs Valentin Schneider
2026-09-02 12:39 ` [PATCH v5 4/8] rtla/osnoise: Allow IPI filters to gracefully fail Valentin Schneider
2026-09-02 12:39 ` [PATCH v5 5/8] rtla: make struct trace_events double linked Valentin Schneider
2026-09-02 12:39 ` [PATCH v5 6/8] rtla: Enable and disable events in the user-defined order Valentin Schneider
2026-09-02 12:39 ` [PATCH v5 7/8] rtla: Unconditionally clean any pre-existing filters for user-provided events Valentin Schneider
2026-09-02 13:44 ` sashiko-bot [this message]
2026-09-02 12:39 ` [PATCH v5 8/8] rtla/osnoise: Trace IPI events when recording a trace file Valentin Schneider
2026-09-02 13:55 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260902134412.943AD1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.