BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Gabriele Monaco" <gmonaco@redhat.com>,
	linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v3 11/18] tools/rv: Rework tracing to support generic events
Date: Thu, 26 Nov 2026 13:13:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-235580@kernel.org> (raw)
In-Reply-To: <20261126130004.127155-12-gmonaco@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] tools/rv: missing pid field check in enable_specific_event()
  self filter
--

commit 6b11a8a850e9f9fbce2a029fa1ab5858e9dcc9dc
Author: Gabriele Monaco <gmonaco@redhat.com>

tools/rv: Rework tracing to support generic events

This commit replaces the DA-specific trace event formatting callbacks
with default tep_print_event() formatting and moves self-PID filtering
into ftrace event filters to support LTL and generic BPF monitor events.

> diff --git a/tools/verification/rv/src/trace.c b/tools/verification/rv/src/trace.c
> index aa4bb73624ecd..6fdbff2c28d45 100644
> --- a/tools/verification/rv/src/trace.c
> +++ b/tools/verification/rv/src/trace.c
[ ... ]
> +/*
> + * enable_specific_event - enable a monitor-specific event with filters
>   */
> -static int da_event_handler(struct trace_seq *s, struct tep_record *record,
> -			    struct tep_event *trace_event, void *context)
> +static int enable_specific_event(struct trace_instance *inst, const char *event_name)
>  {
> -	char *state, *event, *next_state;
> -	unsigned long long final_state;
> -	unsigned long long pid;
> -	unsigned long long id;
> -	int val;
> -	bool missing_id;
> -
> -	if (config.has_id)
> -		missing_id = tep_get_field_val(s, trace_event, "id", record, &id, 1);
> -
> -	tep_get_common_field_val(s, trace_event, "common_pid", record, &pid, 1);
> +	struct tep_event *tevent = tep_find_event_by_name(inst->tep, "rv", event_name);
> +	char filter[FILTER_MAX] = "";
>  
> -	if (config.has_id && (config.my_pid == id))
> -		return 0;
> -	else if (config.my_pid == pid)
> -		return 0;
> -
> -	tep_print_event(trace_event->tep, s, record, "%16s-%-8d [%.3d] ",
> -			TEP_PRINT_COMM, TEP_PRINT_PID, TEP_PRINT_CPU);
> -
> -	if (config.is_container)
> -		tep_print_event(trace_event->tep, s, record, "%s ", TEP_PRINT_NAME);
> -	else
> -		trace_seq_printf(s, "event ");
> +	if (!tevent) {
> +		err_msg("trace: fail finding the rv:%s event\n", event_name);
> +		return -1;
> +	}
>  
> -	if (config.has_id) {
> -		if (missing_id)
> -			/* placeholder if we are dealing with a mixed-type container*/
> -			trace_seq_printf(s, "        ");
> +	if (config.my_pid > 0) {
> +		if (tep_find_field(tevent, "id"))
> +			snprintf(filter, sizeof(filter), "common_pid != %d && id != %d",
> +				 config.my_pid, config.my_pid);
>  		else
> -			trace_seq_printf(s, "%8llu ", id);
> +			snprintf(filter, sizeof(filter), "common_pid != %d",
> +				 config.my_pid);
>  	}

[Severity: Low]
Does enable_specific_event() miss filtering the target task PID for LTL
monitors?

While per-task DA monitor tracepoints name their target task PID field
"id", LTL monitor tracepoints (event_ltl_monitor_id and
error_ltl_monitor_id in kernel/trace/rv/rv_trace.h) define that field as
"pid".  Because tep_find_field(tevent, "id") returns NULL for LTL
events, the filter falls back to "common_pid != %d" and will not filter
out events targeting the rv process when emitted from another task or
interrupt context (such as sched_waking waking the rv process).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126130004.127155-1-gmonaco@redhat.com?part=11

  reply	other threads:[~2026-11-26 13:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 12:59 [PATCH v3 00/18] rv: Add support for BPF monitors Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 01/18] sched: Add task enqueue/dequeue trace points Gabriele Monaco
2026-11-26 13:13   ` sashiko-bot
2026-11-26 12:59 ` [PATCH v3 02/18] tools/rv: Skip empty pid error in selftest if command failed Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 03/18] rv: Add wrapper macros for monitor tracepoint definitions Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 04/18] rv: Propagate const to model strings and tracepoints Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs Gabriele Monaco
2026-11-26 13:24   ` sashiko-bot
2026-11-26 12:59 ` [PATCH v3 06/18] tools/build: Add a feature test for bpftool-btf Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 07/18] tools/rv: Move argument parsing from in_kernel to utils Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 08/18] tools/rv: Move monitor trace handling to trace.c Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 09/18] tools/rv: Implement BPF monitor discovery and listing Gabriele Monaco
2026-11-26 13:17   ` sashiko-bot
2026-11-26 12:59 ` [PATCH v3 10/18] tools/rv: Implement BPF monitor loading and tracing Gabriele Monaco
2026-11-26 13:14   ` sashiko-bot
2026-11-26 12:59 ` [PATCH v3 11/18] tools/rv: Rework tracing to support generic events Gabriele Monaco
2026-11-26 13:13   ` sashiko-bot [this message]
2026-11-26 12:59 ` [PATCH v3 12/18] tools/rv: Copy stripped bpf_atomic.h from libarena Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 13/18] tools/rv: Add BPF monitors Gabriele Monaco
2026-11-26 13:24   ` sashiko-bot
2026-11-26 13:00 ` [PATCH v3 14/18] tools/rv: Define CONFIG_X86_64 statically for " Gabriele Monaco
2026-11-26 13:00 ` [PATCH v3 15/18] tools/rv: Add -E/--errors-only option Gabriele Monaco
2026-11-26 13:00 ` [PATCH v3 16/18] verification/rvgen: Add support for BPF monitors Gabriele Monaco
2026-11-26 13:14   ` sashiko-bot
2026-11-26 13:00 ` [PATCH v3 17/18] tools/rv: Add selftest for rv bpf monitors Gabriele Monaco
2026-11-26 13:00 ` [PATCH v3 18/18] verification/rvgen: Add selftest for rvgen -b Gabriele Monaco

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=sashiko-outbox-235580@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=gmonaco@redhat.com \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox