From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D5A273858C62; Tue, 3 Jan 2023 09:18:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5A273858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672737538; bh=qpbYks1npai1qxopes1q67+k8aCV6LXAUb85xLw6u/8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fR17IPJeltmQCtCs1sEsyobcJNDRuStocXmerBTiSFs86cCCapSBLSrrnc4aroxJL zXdZ/PBtDG4lwMmO7sor6suyuAyGtgnTxrElBJrfQNBR3CXA+ew2r66RDHsMZyFiG3 8/+Vu4fOn2MchpjHt4H+yDSeMrLmiTMhI4FgJH74= From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug gdb/29941] Inferior call strlen(p) gives segfaults in GDB 13, (somewhat?) works in GDB11 and GDB12 Date: Tue, 03 Jan 2023 09:18:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: 13.1 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29941 --- Comment #5 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Tom de Vries : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D08fd40767539= 6cf9500519f02033e6cec270a4a6 commit 08fd407675396cf9500519f02033e6cec270a4a6 Author: Andrew Burgess Date: Tue Jan 3 10:18:48 2023 +0100 [gdb] Fix segfault during inferior call to ifunc With a simple test-case: ... $ cat test.c char *p =3D "a"; int main (void) { return strlen (p); } $ gcc -g test.c ... we run into this segfault: ... $ gdb -q -batch a.out -ex start -ex "p strlen (p)" Temporary breakpoint 1 at 0x1151: file test.c, line 4. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.= 1". Temporary breakpoint 1, main () at test.c:4 4 return strlen (p); Fatal signal: Segmentation fault ... The strlen is an ifunc, and consequently during the call to call_function_by_hand_dummy for "p strlen (p)" another call to call_function_by_hand_dummy is used to resolve the ifunc. This invalidates the get_current_frame () result in the outer call. Fix this by using prepare_reinflate and reinflate. Note that this series ( =20=20=20 https://inbox.sourceware.org/gdb-patches/20221214033441.499512-1-simon.marc= hi@polymtl.ca/ ) should address this problem, but this patch is a simpler fix which is e= asy to backport. Tested on x86_64-linux. Co-Authored-By: Tom de Vries PR gdb/29941 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29941 --=20 You are receiving this mail because: You are on the CC list for the bug.=