From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 05/12] perf debuginfo: Show the debuginfod fetch progress and keys in the TUI
Date: Wed, 16 Sep 2026 12:00:56 +0000 [thread overview]
Message-ID: <20260916120057.6EE491F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260916114740.48230-6-acme@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] perf tui: infinite padding loop on narrow terminal width
--
commit bf7df34cfc153e952fa2cf73c078a1a435dfeb1c
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf debuginfo: Show the debuginfod fetch progress and keys in the TUI
The stdio only fetch UI left a fetch in progress in the TUI with
nothing on screen, indistinguishable from perf being stuck, with no way
out of it. The browser thread is the one doing the fetch, so it draws a
window over itself with the fetch progress and drains the 's'/'d' keys
from the input queue it owns.
> diff --git a/tools/perf/ui/tui/util.c b/tools/perf/ui/tui/util.c
> index e4d322ce0b54c..c3274b92b0e22 100644
> --- a/tools/perf/ui/tui/util.c
> +++ b/tools/perf/ui/tui/util.c
[ ... ]
> +void ui__progress_window(const char *title, const char *text,
> + u64 fetched, u64 total)
> +{
> + static char lines[PROGRESS_WINDOW_MAX_LINES][256];
> + char buf_cur[20], buf_tot[20], bytes[64];
> + size_t len;
> + int y, height, nr_lines, inner, i;
> +
> + if (use_browser != 1)
> + return;
> +
> + unit_number__scnprintf(buf_cur, sizeof(buf_cur), fetched);
> + if (total) {
> + unit_number__scnprintf(buf_tot, sizeof(buf_tot), total);
> + scnprintf(bytes, sizeof(bytes), " %s / %s fetched",
> + buf_cur, buf_tot);
> + } else {
> + scnprintf(bytes, sizeof(bytes),
> + " %s fetched, size unknown", buf_cur);
> + }
> +
> + if (progress_window__shown && !strcmp(bytes, progress_window__bytes))
> + return;
> +
> + scnprintf(progress_window__bytes, sizeof(progress_window__bytes),
> + "%s", bytes);
> + progress_window__shown = true;
> +
> + ui__refresh_dimensions(false);
> + mutex_lock(&ui__lock);
> + inner = SLtt_Screen_Cols - 2;
> + if (inner > 255)
> + inner = 255;
> + nr_lines = progress_window__wrap(text, inner, lines);
[Severity: Medium]
If the terminal is resized to 0 or 1 columns during a fetch, could
SLtt_Screen_Cols - 2 underflow to a negative value, allowing inner to
become negative without bounds checking here?
> + height = nr_lines + 3;
> +
> + SLsmg_set_color(0);
> + if (progress_window__rows)
> + SLsmg_fill_region(progress_window__y, 0, progress_window__rows,
> + SLtt_Screen_Cols, ' ');
> + y = (SLtt_Screen_Rows - height) / 2;
> + if (y < 0)
> + y = 0;
> + progress_window__y = y;
> + progress_window__rows = height;
> +
> + SLsmg_draw_box(y, 0, height, SLtt_Screen_Cols);
> + SLsmg_gotorc(y++, 1);
> + len = strlen(title);
> + if (len > (size_t)inner)
> + len = inner;
> + SLsmg_write_nchars(title, len);
[Severity: Medium]
If inner is negative, won't casting it to size_t result in a huge unsigned
value? This seems like it would bypass the length bounds check and could read
out of bounds.
> + for (i = 0; i < nr_lines; i++, y++) {
> + SLsmg_gotorc(y, 1);
> + SLsmg_write_nstring(lines[i], SLtt_Screen_Cols - 2);
> + }
[Severity: Medium]
Could passing SLtt_Screen_Cols - 2 as a negative value here convert to a
massive unsigned parameter in the TUI renderer SLsmg_write_nstring()? This
seems like it would cause an endless padding loop that spikes the CPU and
locks up the TUI.
> + SLsmg_gotorc(y, 1);
> + SLsmg_write_nstring(bytes, SLtt_Screen_Cols - 2);
[Severity: Medium]
Does this also pass the same potentially underflowed width value to the padding
function?
> + SLsmg_refresh();
> + mutex_unlock(&ui__lock);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260916114740.48230-1-acme@kernel.org?part=5
next prev parent reply other threads:[~2026-09-16 12:00 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 11:47 [PATCH v6 0/12] perf tools: Annotate fixes, stdio progress indication, debuginfo-client in more places Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 01/12] perf test: Skip data_type_profiling when the PMU cannot record memory events Arnaldo Carvalho de Melo
2026-09-16 11:53 ` sashiko-bot
2026-09-16 11:47 ` [PATCH 02/12] perf debuginfo: Fetch debuginfo keyed by build ID using debuginfod Arnaldo Carvalho de Melo
2026-09-16 11:57 ` sashiko-bot
2026-09-16 17:59 ` Ian Rogers
2026-09-16 19:02 ` Arnaldo Carvalho de Melo
2026-09-16 21:28 ` Ian Rogers
2026-09-16 18:42 ` Namhyung Kim
2026-09-16 11:47 ` [PATCH 03/12] perf config: Move perf_config__set_variable() to util/config.c Arnaldo Carvalho de Melo
2026-09-16 12:01 ` sashiko-bot
2026-09-16 11:47 ` [PATCH 04/12] perf debuginfo: Let the user skip and disable debuginfod fetches Arnaldo Carvalho de Melo
2026-09-16 11:59 ` sashiko-bot
2026-09-16 18:53 ` Namhyung Kim
2026-09-16 21:27 ` Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 05/12] perf debuginfo: Show the debuginfod fetch progress and keys in the TUI Arnaldo Carvalho de Melo
2026-09-16 12:00 ` sashiko-bot [this message]
2026-09-16 11:47 ` [PATCH 06/12] perf symbol: Fall back to fetching the vmlinux by build ID Arnaldo Carvalho de Melo
2026-09-16 12:05 ` sashiko-bot
2026-09-16 11:47 ` [PATCH 07/12] perf annotate-data: Show the sample count in the data-type browser Arnaldo Carvalho de Melo
2026-09-16 11:55 ` sashiko-bot
2026-09-16 21:28 ` Namhyung Kim
2026-09-22 12:52 ` Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 08/12] perf report: Add --progress option Arnaldo Carvalho de Melo
2026-09-16 11:57 ` sashiko-bot
2026-09-16 11:47 ` [PATCH 09/12] perf scripts: Add perf-stuck, to tell where a running perf is stuck Arnaldo Carvalho de Melo
2026-09-16 12:00 ` sashiko-bot
2026-09-16 11:47 ` [PATCH 10/12] perf annotate-data: Resolve type DIEs in the debug file they came from Arnaldo Carvalho de Melo
2026-09-16 12:01 ` sashiko-bot
2026-09-16 21:44 ` Namhyung Kim
2026-09-17 14:07 ` Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 11/12] perf mem record: Request PERF_SAMPLE_CPU by default Arnaldo Carvalho de Melo
2026-09-16 12:06 ` sashiko-bot
2026-09-16 21:50 ` Namhyung Kim
2026-09-16 11:47 ` [PATCH 12/12] perf mem record: Use the IBS swfilt filter when available Arnaldo Carvalho de Melo
2026-09-16 12:00 ` sashiko-bot
2026-09-16 21:59 ` Namhyung Kim
2026-09-18 3:35 ` Ravi Bangoria
2026-09-18 15:44 ` Arnaldo Carvalho de Melo
2026-09-19 2:38 ` Ravi Bangoria
2026-09-16 22:27 ` [PATCH v6 0/12] perf tools: Annotate fixes, stdio progress indication, debuginfo-client in more places Namhyung Kim
2026-09-17 9:04 ` Arnaldo Melo
-- strict thread matches above, loose matches on Subject: below --
2026-09-16 18:32 Arnaldo Carvalho de Melo
2026-09-16 18:32 ` [PATCH 05/12] perf debuginfo: Show the debuginfod fetch progress and keys in the TUI Arnaldo Carvalho de Melo
2026-09-16 18:44 ` 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=20260916120057.6EE491F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acme@kernel.org \
--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