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.129.124]) by sourceware.org (Postfix) with ESMTPS id BB7843858D20 for ; Fri, 4 Feb 2022 13:58:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BB7843858D20 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-147-NUmyeFPONpOujIe67Sezew-1; Fri, 04 Feb 2022 08:58:30 -0500 X-MC-Unique: NUmyeFPONpOujIe67Sezew-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35D6A190D341; Fri, 4 Feb 2022 13:58:29 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.205]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 435D870D50; Fri, 4 Feb 2022 13:58:27 +0000 (UTC) From: Florian Weimer To: Jacob Kroon via Gdb Subject: Re: Debugging ld.so in gdb References: <29e0ef71-4706-9b0f-2a68-e12c54120d8e@gmail.com> Date: Fri, 04 Feb 2022 14:58:26 +0100 In-Reply-To: <29e0ef71-4706-9b0f-2a68-e12c54120d8e@gmail.com> (Jacob Kroon via Gdb's message of "Fri, 4 Feb 2022 14:45:33 +0100") Message-ID: <8735kypwcd.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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 13:58:35 -0000 * Jacob Kroon via Gdb: > Since a week or two I have started to see a segfault on my updated > Fedora 35 system. I suspect the segfault is related to a recent glibc > update. > > The segfault I see happens when I run the following: > > $ ldd ./mylib.so > > I narrowed it down to running: > > $ LD_TRACE_LOADED_OBJECTS=1 /lib64/ld-linux-x86-64.so.2 ./mylib.so > > "coredumpctl info" gives me: > >> Stack trace of thread 143567: >> #0 0x00007ff428f73590 n/a (n/a + 0x0) >> #1 0x00007ff428f8af0f _dl_map_object_deps (/usr/lib64/ld-linux-x86-64.so.2 + 0x3f0f) >> #2 0x00007ff428fa6970 dl_main (/usr/lib64/ld-linux-x86-64.so.2 + 0x1f970) >> #3 0x00007ff428fa2c7c _dl_sysdep_start (/usr/lib64/ld-linux-x86-64.so.2 + 0x1bc7c) >> #4 0x00007ff428fa4678 _dl_start_final (/usr/lib64/ld-linux-x86-64.so.2 + 0x1d678) >> #5 0x00007ff428fa36a8 _start (/usr/lib64/ld-linux-x86-64.so.2 + 0x1c6a8) > > but inspecting in gdb using "coredumpctl debug" doesn't give me any sane > backtrace. > > The .so is part of a Yocto build. If I copy the file out from its build > directory to $HOME and run ldd on it, then there is no crash. So I > suspect RUNPATH is involved somehow since it contains $ORIGIN. > > Any ideas of what I can do to investigate further ? I suggest to run ld.so under GDB, with set startup-with-shell off set environment LD_TRACE_LOADED_OBJECTS 1 b _start run ./mylib.so record btrace pt continue And after the crash, look at record instruction-history to see how it reached the crash. This assumes that you have an execution environment that supports branch tracing. Thanks, Florian