Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jiebin Sun" <jiebin.sun@intel.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 08/14] perf c2c: add HPP list parsing for function view histograms
Date: Fri, 17 Jul 2026 02:22:01 +0000	[thread overview]
Message-ID: <20260717022202.659971F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260717020530.1645123-9-jiebin.sun@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Calling `perf_hpp__setup_output_field()` with a local list inadvertently pollutes the global `perf_hpp_list` and fails to populate the local list's output fields with the missing sort keys. This causes a type confusion/out-of-bounds read and completely breaks the newly added function view.
--

--- Patch [8]: [PATCH v3 08/14] perf c2c: add HPP list parsing for function view histograms ---
commit f3ca20deabb9c494811fc6797c416d4130121e41
Author: Jiebin Sun <jiebin.sun@intel.com>

perf c2c: add HPP list parsing for function view histograms

This adds the histogram initialization and column parsing infrastructure
for the function view in perf c2c. It provides functions to parse column
strings and initialize histograms with custom dimensions.

> diff --git a/tools/perf/ui/browsers/c2c-function.c b/tools/perf/ui/browsers/c2c-function.c
> index d79d131b1f18c..487f9a68d4a43 100644
> --- a/tools/perf/ui/browsers/c2c-function.c
> +++ b/tools/perf/ui/browsers/c2c-function.c

[ ... ]

> +static int
> +function_hpp_list__parse(struct perf_hpp_list *hpp_list,
> +			 const char *output_str,
> +			 const char *sort_str,
> +			 struct perf_env *env)
> +{

[ ... ]

> +	ret = function_hpp_list__add_tokens(hpp_list, sort, env,
> +					    c2c_function_hists__init_sort);
> +	if (ret)
> +		goto out;
> +
> +	perf_hpp__setup_output_field(hpp_list);

[Severity: High]
This is a pre-existing issue in the core formatting infrastructure, but
will calling perf_hpp__setup_output_field() here fail to populate the local
list's output fields?

The underlying function in tools/perf/ui/hist.c hardcodes registration to
the global perf_hpp_list. This causes the local list to remain empty, while
polluting the global list with local dynamic formats.

This also triggers a type confusion and out-of-bounds read. When a standard
format is compared to a c2c_fmt in perf_hpp__setup_output_field(),
c2c_fmt_equal() casts the standard format to c2c_fmt and reads the
out-of-bounds dim pointer.

> +out:
> +	if (ret)
> +		perf_hpp__reset_output_field(hpp_list);
> +	free(output);
> +	free(sort);
> +	return ret;
> +}
> +
> +static __maybe_unused int
> +c2c_function_hists__init(struct c2c_hists *hists,
> +			 const char *sort,
> +			 int nr_header_lines,
> +			 struct perf_env *env)
> +{
> +	__hists__init(&hists->hists, &hists->list);
> +
> +	perf_hpp_list__init(&hists->list);
> +
> +	hists->list.nr_header_lines = nr_header_lines;
> +
> +	return function_hpp_list__parse(&hists->list, /*output=*/NULL, sort, env);

[Severity: High]
Because this passes NULL for the output format string and relies entirely on
perf_hpp__setup_output_field() to populate the missing sort keys, won't the
new function view fail to render any columns?

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260717020530.1645123-1-jiebin.sun@intel.com?part=8

  reply	other threads:[~2026-07-17  2:22 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26  7:03 [PATCH 00/14] perf c2c: add a function view Jiebin Sun
2026-06-26  7:03 ` [PATCH 01/14] perf c2c: extract shared data structures into c2c.h Jiebin Sun
2026-06-26  7:13   ` sashiko-bot
2026-07-16 17:51     ` Namhyung Kim
2026-07-17  1:43       ` Jiebin Sun
2026-06-26  7:03 ` [PATCH 02/14] perf c2c: add function view browser skeleton Jiebin Sun
2026-06-26  7:11   ` sashiko-bot
2026-06-26  7:03 ` [PATCH 03/14] perf c2c: add function view type definitions and helpers Jiebin Sun
2026-06-26  7:14   ` sashiko-bot
2026-06-26  7:03 ` [PATCH 04/14] perf c2c: add column format infrastructure for function view Jiebin Sun
2026-06-26  7:03 ` [PATCH 05/14] perf c2c: add column entry functions " Jiebin Sun
2026-06-26  7:03 ` [PATCH 06/14] perf c2c: add comparison functions for function view sorting Jiebin Sun
2026-06-26  7:22   ` sashiko-bot
2026-06-26  7:03 ` [PATCH 07/14] perf c2c: add dimension definitions and format creation Jiebin Sun
2026-06-26  7:23   ` sashiko-bot
2026-06-26  7:03 ` [PATCH 08/14] perf c2c: add HPP list parsing for function view histograms Jiebin Sun
2026-06-26  7:16   ` sashiko-bot
2026-06-26  7:03 ` [PATCH 09/14] perf c2c: add stats merging and memory management helpers Jiebin Sun
2026-06-26  7:17   ` sashiko-bot
2026-06-26  7:03 ` [PATCH 10/14] perf c2c: add hierarchy entry creation and lookup functions Jiebin Sun
2026-06-26  7:19   ` sashiko-bot
2026-06-26  7:03 ` [PATCH 11/14] perf c2c: add function view hierarchy builder Jiebin Sun
2026-06-26  7:03 ` [PATCH 12/14] perf c2c: add function view browser UI Jiebin Sun
2026-06-26  7:03 ` [PATCH 13/14] perf c2c: add TAB key to switch to function view Jiebin Sun
2026-06-26  7:03 ` [PATCH 14/14] perf c2c: document function view in perf-c2c man page Jiebin Sun
2026-07-07  0:41 ` [PATCH 00/14] perf c2c: add a function view Namhyung Kim
2026-07-10  8:49   ` Jiebin Sun
2026-07-10 21:54     ` Namhyung Kim
2026-07-13  9:22       ` Jiebin Sun
2026-07-10  8:42 ` [PATCH v2 " Jiebin Sun
2026-07-10  8:42   ` [PATCH v2 01/14] perf c2c: extract shared data structures into c2c.h Jiebin Sun
2026-07-10  8:54     ` sashiko-bot
2026-07-10  8:42   ` [PATCH v2 02/14] perf c2c: add function view browser skeleton Jiebin Sun
2026-07-10  8:50     ` sashiko-bot
2026-07-10  8:42   ` [PATCH v2 03/14] perf c2c: add function view type definitions and helpers Jiebin Sun
2026-07-10  8:42   ` [PATCH v2 04/14] perf c2c: add column format infrastructure for function view Jiebin Sun
2026-07-10  9:00     ` sashiko-bot
2026-07-10  8:42   ` [PATCH v2 05/14] perf c2c: add column entry functions " Jiebin Sun
2026-07-10  8:42   ` [PATCH v2 06/14] perf c2c: add comparison functions for function view sorting Jiebin Sun
2026-07-10  8:42   ` [PATCH v2 07/14] perf c2c: add dimension definitions and format creation Jiebin Sun
2026-07-10  8:42   ` [PATCH v2 08/14] perf c2c: add HPP list parsing for function view histograms Jiebin Sun
2026-07-10  9:01     ` sashiko-bot
2026-07-10  8:42   ` [PATCH v2 09/14] perf c2c: add stats merging and memory management helpers Jiebin Sun
2026-07-10  8:42   ` [PATCH v2 10/14] perf c2c: add hierarchy entry creation and lookup functions Jiebin Sun
2026-07-10  8:42   ` [PATCH v2 11/14] perf c2c: add function view hierarchy builder Jiebin Sun
2026-07-10  9:01     ` sashiko-bot
2026-07-10  8:42   ` [PATCH v2 12/14] perf c2c: add function view browser UI Jiebin Sun
2026-07-10  8:42   ` [PATCH v2 13/14] perf c2c: add TAB key to switch to function view Jiebin Sun
2026-07-10  8:42   ` [PATCH v2 14/14] perf c2c: document function view in perf-c2c man page Jiebin Sun
2026-07-17  2:05   ` [PATCH v3 00/14] perf c2c: add a function view Jiebin Sun
2026-07-17  2:05     ` [PATCH v3 01/14] perf c2c: extract shared data structures into c2c.h Jiebin Sun
2026-07-17  2:14       ` sashiko-bot
2026-07-17  2:05     ` [PATCH v3 02/14] perf c2c: add function view browser skeleton Jiebin Sun
2026-07-17  2:15       ` sashiko-bot
2026-07-17  2:05     ` [PATCH v3 03/14] perf c2c: add function view type definitions and helpers Jiebin Sun
2026-07-17  2:15       ` sashiko-bot
2026-07-17  2:05     ` [PATCH v3 04/14] perf c2c: add column format infrastructure for function view Jiebin Sun
2026-07-17  2:21       ` sashiko-bot
2026-07-17  2:05     ` [PATCH v3 05/14] perf c2c: add column entry functions " Jiebin Sun
2026-07-17  2:19       ` sashiko-bot
2026-07-17  2:05     ` [PATCH v3 06/14] perf c2c: add comparison functions for function view sorting Jiebin Sun
2026-07-17  2:05     ` [PATCH v3 07/14] perf c2c: add dimension definitions and format creation Jiebin Sun
2026-07-17  2:05     ` [PATCH v3 08/14] perf c2c: add HPP list parsing for function view histograms Jiebin Sun
2026-07-17  2:22       ` sashiko-bot [this message]
2026-07-17  2:05     ` [PATCH v3 09/14] perf c2c: add stats merging and memory management helpers Jiebin Sun
2026-07-17  2:05     ` [PATCH v3 10/14] perf c2c: add hierarchy entry creation and lookup functions Jiebin Sun
2026-07-17  2:20       ` sashiko-bot
2026-07-17  2:05     ` [PATCH v3 11/14] perf c2c: add function view hierarchy builder Jiebin Sun
2026-07-17  2:05     ` [PATCH v3 12/14] perf c2c: add function view browser UI Jiebin Sun
2026-07-17  2:05     ` [PATCH v3 13/14] perf c2c: add TAB key to switch to function view Jiebin Sun
2026-07-17  2:05     ` [PATCH v3 14/14] perf c2c: document function view in perf-c2c man page Jiebin Sun

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=20260717022202.659971F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jiebin.sun@intel.com \
    --cc=linux-perf-users@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