Linux Perf Users
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 3/8] perf tools: Check system path when check debuginfo
Date: Mon, 28 Sep 2026 17:37:47 -0700	[thread overview]
Message-ID: <arsIW-1drTVVsuBR@z2> (raw)
In-Reply-To: <20260928055956.D386E1F000FF@smtp.kernel.org>

On Mon, Sep 28, 2026 at 05:59:56AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] perf tools: Loss of DWARF support for .gnu_debugdata and .zdebug_info
> --
> 
> commit 945ce7f07042383e50c7db270f3808ce02dd95b3
> Author: Namhyung Kim <namhyung@kernel.org>
> 
> perf tools: Check system path when check debuginfo
> 
> This commit removes the fallback to open the given binary path in
> debuginfo__new() and instead relies on checking the SYSTEM_PATH_DSO
> type within dso__find_dbginfo_type().
> 
> > 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;
> >  
> >  	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);
> 
> [Severity: High]
> Does removing this fallback break DWARF support for files using alternative
> debug sections like .gnu_debugdata (mini-debuginfo) or .zdebug_info?

IIUC ".gnu_debugdata" on Fedora only carries symbol tables so it doesn't
check DSO_BINARY_TYPE__GNU_DEBUGDATA and no need to check the section.
But I think I need to add ".zdebug_info".

> 
> The new logic entirely relies on dso__find_dbginfo_type() successfully
> returning a binary type. However, dso__find_dbginfo_type() strictly
> validates the file by exact string match:
> 
> tools/perf/util/dso.c:dso__find_dbginfo_type() {
> 	...
> 		if (filename__has_section(buf, ".debug_info"))
> 			break;
> 	...
> }
> 
> Because files relying on .gnu_debugdata or .zdebug_info do not have a section
> named exactly ".debug_info", this check fails. The type then defaults to
> DSO_BINARY_TYPE__NOT_FOUND, and debuginfo__new() returns NULL.
> 
> Could this cause features like inline callchain resolution to silently fail on
> these binaries since we completely bypass libdw's native support for parsing
> these alternative formats?

Something like this?

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 10c4cd35b6d9464b..0b152988d18b60b0 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -2130,7 +2130,8 @@ void dso__find_dbginfo_type(struct dso *dso)
                                                   buf, PATH_MAX) < 0)
                        continue;

-               if (filename__has_section(buf, ".debug_info"))
+               if (filename__has_section(buf, ".debug_info") ||
+                   filename__has_section(buf, ".zdebug_info"))
                        break;
        }

Thanks,
Namhyung


> 
> > +	return dinfo;
> >  }
> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260928055055.95144-1-namhyung@kernel.org?part=3

  reply	other threads:[~2026-09-29  0:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28  5:50 [PATCH v1 0/8] perf tools: Cleanup dso debug info access Namhyung Kim
2026-09-28  5:50 ` [PATCH v1 1/8] perf tools: Add dso->dbginfo_type field Namhyung Kim
2026-09-28  5:57   ` sashiko-bot
2026-09-28  5:50 ` [PATCH v1 2/8] perf tools: Factor out dso__find_dbginfo_type() Namhyung Kim
2026-09-28  5:58   ` sashiko-bot
2026-09-28  5:50 ` [PATCH v1 3/8] perf tools: Check system path when check debuginfo Namhyung Kim
2026-09-28  5:59   ` sashiko-bot
2026-09-29  0:37     ` Namhyung Kim [this message]
2026-09-28  5:50 ` [PATCH v1 4/8] perf tools: Export dso__get_filename() with type argument Namhyung Kim
2026-09-28  6:13   ` sashiko-bot
2026-09-28  5:50 ` [PATCH v1 5/8] perf tools: Add dso__put_filename() Namhyung Kim
2026-09-28  5:56   ` sashiko-bot
2026-09-28  5:50 ` [PATCH v1 6/8] perf tools: Avoid repeated failing search for debuginfo Namhyung Kim
2026-09-28  6:08   ` sashiko-bot
2026-09-28  5:50 ` [PATCH v1 7/8] perf tools: Looks symbol file first when check debuginfo Namhyung Kim
2026-09-28  6:10   ` sashiko-bot
2026-09-28  5:50 ` [PATCH v1 8/8] perf tools: Update debuginfo__new() to take DSO Namhyung Kim
2026-09-28  6:02   ` sashiko-bot
2026-09-28 16:45 ` [PATCH v1 0/8] perf tools: Cleanup dso debug info access Arnaldo Carvalho de Melo
2026-09-29  0:38   ` Namhyung Kim

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=arsIW-1drTVVsuBR@z2 \
    --to=namhyung@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