From: sashiko-bot@kernel.org
To: "Kyuwon Cho" <kyuwon.cho@skku.edu>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v2] tracing: compare named histogram expressions recursively
Date: Thu, 03 Dec 2026 20:09:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-248593@kernel.org> (raw)
In-Reply-To: <179632407670.3855722.5777623149223641405@skku.edu>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] tracing: compatible_hist_field() breaks folded constant
trigger matching
--
commit a54aeffb718b2b83eae3b41eb128f6a532470471
Author: Kyuwon Cho <kyuwon.cho@skku.edu>
tracing: compare named histogram expressions recursively
This commit replaces the shallow field check in hist_trigger_match()
with a recursive compatible_hist_field() helper that compares
expression metadata and operand trees before matching histogram
triggers.
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index d4702ad4e0036..63d06f39a5cbb 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -6474,6 +6474,51 @@ static bool compatible_field(struct ftrace_event_field *field,
> return true;
> }
>
> +static bool compatible_optional_string(const char *str, const char *test_str)
> +{
> + if (!str || !test_str)
> + return str == test_str;
> +
> + return strcmp(str, test_str) == 0;
> +}
> +
> +static bool compatible_hist_field(struct hist_field *field,
> + struct hist_field *test_field)
> +{
> + unsigned int i;
> +
> + if (field->flags != test_field->flags ||
> + field->fn_num != test_field->fn_num ||
> + !compatible_field(field->field, test_field->field) ||
> + field->offset != test_field->offset ||
> + field->size != test_field->size ||
> + field->is_signed != test_field->is_signed ||
> + field->buckets != test_field->buckets ||
> + field->operator != test_field->operator ||
> + field->constant != test_field->constant ||
> + !compatible_optional_string(field->type, test_field->type) ||
> + !compatible_optional_string(field->name, test_field->name) ||
[Severity: Medium]
Does unconditionally comparing field->name here break matching for
constant-folded histogram expressions?
When parse_expr() folds constants (such as vals=1+2), it sets
HIST_FIELD_FL_CONST and assigns expr->name via expr_str(). Because
hist_field_print() prints only the folded literal (3), feeding the
trigger back in parses it via parse_const() with field->name as NULL.
compatible_optional_string() then returns false, so removing the trigger
(!hist:...) using the printed specification silently leaves it active,
and :pause/:cont/:clear updates fail to match. Skipping the field->name
check for HIST_FIELD_FL_CONST fields would avoid this regression.
--
Sashiko AI review · https://sashiko.dev/#/patchset/179632407670.3855722.5777623149223641405@skku.edu?part=1
prev parent reply other threads:[~2026-12-03 20:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 19:49 [PATCH v2] tracing: compare named histogram expressions recursively Kyuwon Cho
2026-12-03 20:09 ` sashiko-bot [this message]
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-248593@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kyuwon.cho@skku.edu \
--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