Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Namhyung Kim" <namhyung@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 3/8] perf tools: Check system path when check debuginfo
Date: Tue, 29 Sep 2026 01:23:02 +0000	[thread overview]
Message-ID: <20260929012302.984D51F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260929011139.53242-4-namhyung@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] perf: skipping libdw fallback on stripped binaries breaks debuginfod
--

commit b8cad86bb3e8eff20f4bbb18f568843350d829d9
Author: Namhyung Kim <namhyung@kernel.org>

perf tools: Check system path when check debuginfo

This commit refactors debuginfo__new() to check the system path via
dso__find_dbginfo_type() rather than using an explicit fallback. The new
approach adds DSO_BINARY_TYPE__SYSTEM_PATH_DSO to the debuginfo types list
and removes the fallback code in debuginfo__new().

> diff --git a/tools/perf/util/debuginfo.c b/tools/perf/util/debuginfo.c
> index d6bd0fcc22648..2669d5f5ee612 100644
> --- a/tools/perf/util/debuginfo.c
> +++ b/tools/perf/util/debuginfo.c
[ ... ]
> @@ -114,18 +114,12 @@ struct debuginfo *debuginfo__new(const char *path)
>  	dso__find_dbginfo_type(dso);
>  	if (dso__read_binary_type_filename(dso, dso__dbginfo_type(dso), &nil,
>  					   buf, PATH_MAX) < 0)
> -		goto out;
> +		return NULL;

[Severity: High]
Does this skip the libdw fallback entirely for stripped binaries, which
could break remote debuginfo resolution via debuginfod?

When running a tool like perf annotate on a stripped binary that lacks local
debuginfo files, dso__find_dbginfo_type() checks for debug sections:

tools/perf/util/dso.c:dso__find_dbginfo_type() {
    ...
		if (filename__has_section(buf, ".debug_info") ||
		    filename__has_section(buf, ".zdebug_info"))
			break;
    ...
}

Because stripped binaries fail this section check, their type is marked as
DSO_BINARY_TYPE__NOT_FOUND even when DSO_BINARY_TYPE__SYSTEM_PATH_DSO is
evaluated.

This causes the dso__read_binary_type_filename() check in debuginfo__new()
to fail and return NULL early. By bypassing __debuginfo__new(), this
prevents libdw from invoking dwfl_standard_find_debuginfo() to remotely
resolve the debuginfo.

>  
>  	dinfo = __debuginfo__new(buf);
>  	dso__put(dso);
>  
> -out:
> -	if (dinfo)
> -		return dinfo;
> -
> -	/* if failed to open all distro debuginfo, open given binary */
> -	symbol__join_symfs(buf, path);
> -	return __debuginfo__new(buf);
> +	return dinfo;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260929011139.53242-1-namhyung@kernel.org?part=3

  reply	other threads:[~2026-09-29  1:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  1:11 [PATCH v2 0/8] perf tools: Cleanup dso debug info access Namhyung Kim
2026-09-29  1:11 ` [PATCH v2 1/8] perf tools: Add dso->dbginfo_type field Namhyung Kim
2026-09-29  1:18   ` sashiko-bot
2026-09-29  1:11 ` [PATCH v2 2/8] perf tools: Factor out dso__find_dbginfo_type() Namhyung Kim
2026-09-29  1:19   ` sashiko-bot
2026-09-29  1:11 ` [PATCH v2 3/8] perf tools: Check system path when check debuginfo Namhyung Kim
2026-09-29  1:23   ` sashiko-bot [this message]
2026-09-29 18:18     ` Namhyung Kim
2026-09-29 18:48       ` Arnaldo Carvalho de Melo
2026-09-29  1:11 ` [PATCH v2 4/8] perf tools: Export dso__get_filename() with type argument Namhyung Kim
2026-09-29  1:21   ` sashiko-bot
2026-09-29  1:11 ` [PATCH v2 5/8] perf tools: Add dso__put_filename() Namhyung Kim
2026-09-29  1:18   ` sashiko-bot
2026-09-29  1:11 ` [PATCH v2 6/8] perf tools: Avoid repeated failing search for debuginfo Namhyung Kim
2026-09-29  1:25   ` sashiko-bot
2026-09-29  1:11 ` [PATCH v2 7/8] perf tools: Looks symbol file first when check debuginfo Namhyung Kim
2026-09-29  1:27   ` sashiko-bot
2026-09-29  1:11 ` [PATCH v2 8/8] perf tools: Update debuginfo__new() to take DSO Namhyung Kim
2026-09-29  1:18   ` sashiko-bot
2026-09-29 23:58   ` Masami Hiramatsu
2026-09-29 18:58 ` [PATCH v2 0/8] perf tools: Cleanup dso debug info access Arnaldo Carvalho de Melo

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=20260929012302.984D51F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@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