From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 070BB3858D20 for ; Fri, 4 Feb 2022 17:15:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 070BB3858D20 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-226-mk-qzzJqMKmzwDoHlERQPA-1; Fri, 04 Feb 2022 12:15:13 -0500 X-MC-Unique: mk-qzzJqMKmzwDoHlERQPA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8FABD1091DA9; Fri, 4 Feb 2022 17:15:12 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.205]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDC358588C; Fri, 4 Feb 2022 17:15:11 +0000 (UTC) From: Florian Weimer To: Jacob Kroon Cc: Jacob Kroon via Gdb Subject: Re: Debugging ld.so in gdb References: <29e0ef71-4706-9b0f-2a68-e12c54120d8e@gmail.com> <8735kypwcd.fsf@oldenburg.str.redhat.com> <87y22qognw.fsf@oldenburg.str.redhat.com> <87h79eobq1.fsf@oldenburg.str.redhat.com> <87czk2o967.fsf@oldenburg.str.redhat.com> <06f726f4-855e-239b-fd2c-8d0d57f45131@gmail.com> Date: Fri, 04 Feb 2022 18:15:09 +0100 In-Reply-To: <06f726f4-855e-239b-fd2c-8d0d57f45131@gmail.com> (Jacob Kroon's message of "Fri, 4 Feb 2022 18:11:10 +0100") Message-ID: <878ruqo8o2.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Feb 2022 17:15:16 -0000 * Jacob Kroon: >> Interesting. Can you figure out where *rpo points right before things >> go wrong? If the debuginfo doesn't work, this should do it: >>=20 >> print (void *)$rax - 8 >>=20 > > This is what I get: > >> (gdb) record goto 225037 >> Go backward to insn number 225037 >> #0 dfs_traversal (rpo=3Drpo@entry=3D0x7fffffffd3b0, map=3D0x7ffff7fad59= 0, do_reldeps=3Ddo_reldeps@entry=3D0x0) at dl-sort-maps.c:175 >> 175=09 **rpo =3D map; >> (gdb) print *rpo >> $13 =3D (struct link_map **) 0x7fffffffd2c8 >> (gdb) print (void *)$rax - 8 >> $14 =3D (void *) 0x7fffffffd2c8 I wonder where 0x7fffffffd2c8 is located. Maybe on the minimal malloc heap? >> Maybe also look at map->l_name at this point, and further up the stack, >> in dl_sort_maps, at maps and nmaps. It looks like we run off the end of >> the array and write garbage to other areas of the process. 8-( >>=20 > > And this: > >> (gdb) print map->l_name=20 >> $15 =3D 0x7ffff7fad500 "/tmp/ramdisk/jacob-linux-master-glibc/work/x86_6= 4-linux/icedtea7-native/2.1.3-r1.0/icedtea-2.1.3/build/openjdk.build-boot/l= ib/amd64/libjava.so" > > I couldn't find the other variables, maybe I need to get more acquainted > with the sourcecode here. I think you have to enter =E2=80=9Cup=E2=80=9D a couple of times. I suspect we are writing beyond the start of the array passed to _dl_sort_maps. Thanks, Florian