From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: sashiko-reviews@lists.linux.dev, Yanbo Zhao <yzhao62@ncsu.edu>,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 1/3] perf dwarf-aux: Add die_is_compound_type() to handle C++ class types
Date: Fri, 2 Oct 2026 18:34:33 +0200 [thread overview]
Message-ID: <ar_dGYiNoo04-OEK@x2> (raw)
In-Reply-To: <ar6i_ZKXNVZmze2r@google.com>
On Thu, Oct 01, 2026 at 11:14:21AM -0700, Namhyung Kim wrote:
> On Wed, Sep 30, 2026 at 09:10:51PM +0000, sashiko-bot@kernel.org wrote:
> > Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> > - [High] perf/dwarf-aux: stack overflow in __die_find_member_offset_cb via cyclic inheritance
> > - [Medium] perf/dwarf-aux: flex array detection fails for C++ classes
> > --
> >
> > commit 3f3b9b56b2e28f1713af3b40ab8946d5bbc8d245
> > Author: Yanbo Zhao <yzhao62@ncsu.edu>
> >
> > perf dwarf-aux: Add die_is_compound_type() to handle C++ class types
> >
> > This commit introduces die_is_compound_type() to support C++ classes alongside
> > structs and unions. It also updates offset lookups to descend into base class
> > subobjects using DW_TAG_inheritance entries.
> >
> > > diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
> > > index 54f8b5ec74a2f..eb4b8f3475df1 100644
> > > --- a/tools/perf/util/dwarf-aux.c
> > > +++ b/tools/perf/util/dwarf-aux.c
> > > @@ -61,6 +61,14 @@ const char *cu_get_comp_dir(Dwarf_Die *cu_die)
> > > return dwarf_formstring(&attr);
> > > }
> > >
> > > +bool die_is_compound_type(Dwarf_Die *type_die)
> > > +{
> > > + int tag = dwarf_tag(type_die);
> > > +
> > > + return tag == DW_TAG_structure_type || tag == DW_TAG_union_type ||
> > > + tag == DW_TAG_class_type;
> > > +}
> >
> > [Severity: Medium]
> > Does die_has_flex_array_recurse() also need to be updated to use this new
> > helper?
> >
> > If we look at die_has_flex_array_recurse() in tools/perf/util/dwarf-aux.c,
> > it currently forces flex array detection to return false for C++ classes
> > because it explicitly ignores DW_TAG_class_type:
> >
> > if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type)
> > return false;
> > ...
> > if (tag == DW_TAG_structure_type && found) {
> > if (is_flex_array_member(&last_mb))
> > return true;
> >
> > Could this cause accesses to flex array members inside C++ classes to be
> > wrongly rejected as out-of-bounds?
> IIUC C++ officially doesn't support flexible arrays and there are
> better alternatives so I guess it's rare to see them in C++ classes.
> Maybe it's ok to ignore them until we find it's really needed.
ok on both counts, there is another patch with a Sashiko report, can you
guys reply to that one as well?
Thanks,
- Arnaldo
next prev parent reply other threads:[~2026-10-02 16:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 21:00 [PATCH v2 0/3] perf annotate: Data type profiling support for C++ classes and virtual calls Yanbo Zhao
2026-09-30 21:00 ` [PATCH v2 1/3] perf dwarf-aux: Add die_is_compound_type() to handle C++ class types Yanbo Zhao
2026-09-30 21:10 ` sashiko-bot
2026-10-01 18:14 ` Namhyung Kim
2026-10-02 16:34 ` Arnaldo Carvalho de Melo [this message]
2026-10-04 19:54 ` Yanbo Zhao
2026-09-30 21:00 ` [PATCH v2 2/3] perf dwarf-aux: Add C++ vtable helpers Yanbo Zhao
2026-09-30 21:10 ` sashiko-bot
2026-10-02 22:52 ` Namhyung Kim
2026-10-04 19:56 ` Yanbo Zhao
2026-09-30 21:00 ` [PATCH v2 3/3] perf annotate: Resolve C++ virtual function calls in x86 insn tracking Yanbo Zhao
2026-09-30 21:11 ` sashiko-bot
2026-10-02 22:56 ` Namhyung Kim
2026-10-04 19:57 ` Yanbo Zhao
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=ar_dGYiNoo04-OEK@x2 \
--to=acme@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yzhao62@ncsu.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.