From: Muhammad Kamran <muhammad.kamran@arm.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simark@simark.ca>,
Andrew Burgess <aburgess@redhat.com>,
Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
Yury Khrustalev <Yury.Khrustalev@arm.com>,
Thiago Jung Bauermann <thiago.bauermann@linaro.org>,
Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
Carlos O'Donell <carlos@redhat.com>
Subject: Re: [PATCH v4 0/2] gdb: Fix internal inferior calls through GNU IFUNCs
Date: Tue, 4 Aug 2026 10:02:58 +0100 [thread overview]
Message-ID: <cf0e405d-1917-4ff3-a147-5ed0007fcab0@arm.com> (raw)
In-Reply-To: <20260630110443.12900-1-muhammad.kamran@arm.com>
Ping. Is this patch series OK to push?
This would also unblock the GNU IFUNC malloc implementation in glibc.
Thanks,
Kamran
On 30/06/2026 12:04, Muhammad Kamran wrote:
> This series fixes a GDB inferior-call issue exposed by malloc being a GNU
> IFUNC in glibc on AArch64. The underlying problem is not AArch64-specific:
> it can affect any inferior helper found through find_function_in_inferior's
> minimal-symbol fallback when that helper is a GNU IFUNC.
>
> GDB calls find_function_in_inferior ("malloc") when expression evaluation
> needs to allocate memory in the inferior, for example for string literal
> arguments. In the minimal-symbol fallback, GDB created a synthetic ordinary
> function pointer from the minimal symbol address. If the symbol was a GNU
> IFUNC, this lost the IFUNC marker, so call_function_by_hand did not resolve
> the symbol before calling it.
>
> Patch 1 checks the minimal symbol kind directly and propagates the GNU IFUNC
> marker to the synthetic function type for mst_text_gnu_ifunc and
> mst_data_gnu_ifunc symbols. The existing fallback address and return type
> are unchanged.
>
> Patch 2 fixes the follow-on return-type issue after IFUNC resolution. When
> the resolved target type, or the type inferred from the resolver return type,
> does not provide a usable return type, find_function_addr now keeps the
> original function type's return type. This preserves the synthetic fallback
> return type used by find_function_in_inferior ("malloc").
>
> The tests add an internal inferior-call case using an IFUNC malloc and run it
> through the existing gdb.base/gnu-ifunc.exp matrix for resolver attr,
> resolver debug info, and resolved-target debug info.
>
> Changes since v3:
> * Move the ifunc resolver into a shared library.
>
> Changes since v2:
> * Rework the minimal-symbol fallback to check the minimal symbol kind
> directly as suggested by Simon.
> * Add coverage for both debug and no-debug IFUNC malloc variants by
> using the existing framework.
> * Preserve the original IFUNC return type when the resolved target type
> is unknown.
>
> Muhammad Kamran (2):
> gdb: Preserve IFUNC marker when finding inferior functions
> gdb: Keep original IFUNC return type when target type is unknown
>
> gdb/infcall.c | 12 +++-
> .../gdb.base/gnu-ifunc-inferior-call-final.c | 27 ++++++++
> .../gnu-ifunc-inferior-call-resolver.c | 43 ++++++++++++
> .../gdb.base/gnu-ifunc-inferior-call.c | 37 +++++++++++
> gdb/testsuite/gdb.base/gnu-ifunc.exp | 66 +++++++++++++++++++
> gdb/valops.c | 5 ++
> 6 files changed, 188 insertions(+), 2 deletions(-)
> create mode 100644 gdb/testsuite/gdb.base/gnu-ifunc-inferior-call-final.c
> create mode 100644 gdb/testsuite/gdb.base/gnu-ifunc-inferior-call-resolver.c
> create mode 100644 gdb/testsuite/gdb.base/gnu-ifunc-inferior-call.c
>
prev parent reply other threads:[~2026-08-04 9:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 11:04 Muhammad Kamran
2026-06-30 11:04 ` [PATCH v4 1/2] gdb: Preserve IFUNC marker when finding inferior functions Muhammad Kamran
2026-08-10 21:12 ` Andrew Burgess
2026-08-13 12:38 ` Muhammad Kamran
2026-06-30 11:04 ` [PATCH v4 2/2] gdb: Keep original IFUNC return type when target type is unknown Muhammad Kamran
2026-08-11 10:09 ` Andrew Burgess
2026-08-04 9:02 ` Muhammad Kamran [this message]
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=cf0e405d-1917-4ff3-a147-5ed0007fcab0@arm.com \
--to=muhammad.kamran@arm.com \
--cc=Wilco.Dijkstra@arm.com \
--cc=Yury.Khrustalev@arm.com \
--cc=aburgess@redhat.com \
--cc=adhemerval.zanella@linaro.org \
--cc=carlos@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
--cc=thiago.bauermann@linaro.org \
/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