From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id b0p7Cam/AWCNRAAAWB0awg (envelope-from ) for ; Fri, 15 Jan 2021 11:15:37 -0500 Received: by simark.ca (Postfix, from userid 112) id 07E931EF80; Fri, 15 Jan 2021 11:15:36 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5EA441E590 for ; Fri, 15 Jan 2021 11:15:36 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 55EB239730FB; Fri, 15 Jan 2021 16:15:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55EB239730FB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610727335; bh=gZbAVTGikJ/7OK4X03VhGPvRKbhGPSgXbjgDnsxx+hY=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=WrKiR4kLu6ObUcvfuCC2NOZCnW8R0EEngOSI0EjNCU+NNio4NdnMZjgJt2+MLTAD0 fWmb4MbCcvo4hpPhZe3ciccTp1e2+JQ0hnuYEwwqeAtdTD6m1Vsa1+lIG2DwDkfs/Y 6hBRzD/0Y9t4gC1Zx21xLxnSE1lPBl8dMhRFIdBU= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 8B039385782D for ; Fri, 15 Jan 2021 16:15:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8B039385782D Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 10FGFRC8031215 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Jan 2021 11:15:31 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 10FGFRC8031215 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id ED3421E590; Fri, 15 Jan 2021 11:15:26 -0500 (EST) Subject: Re: GDB loading incorrect version library To: noloader@gmail.com, gdb@sourceware.org References: Message-ID: <547cf0c9-1585-07c6-8565-bd2a2048eecf@polymtl.ca> Date: Fri, 15 Jan 2021 11:15:26 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 15 Jan 2021 16:15:27 +0000 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: , From: Simon Marchi via Gdb Reply-To: Simon Marchi Errors-To: gdb-bounces@sourceware.org Sender: "Gdb" On 2021-01-15 2:30 a.m., Jeffrey Walton via Gdb wrote: > Hi Everyone, > > I'm trying to investigate a Bash crash when Bash is instrumented with > Asan. I've got Bash and all of its dependencies built/installed at > ~/ok2delete-asan. All of them are built with Asan. > > GDB startup shows: > > $ gdb ~/ok2delete-asan/bin/bash > gdb: /usr/local/lib/libncursesw.so.6: no version information > available (required by gdb) > > It appears GDB is not loading the proper version of Ncurses: > > (gdb) shell readelf -d ~/ok2delete-asan/bin/bash | grep -E 'RPATH|RUNPATH' > 0x000000000000001d (RUNPATH) Library runpath: > [$ORIGIN/../lib:/home/jwalton/ok2delete-asan/lib] > > And (slightly trimmed): > > (gdb) shell ldd ~/ok2delete-asan/bin/bash > linux-vdso.so.1 (0x00007ffde6bfc000) > libasan.so.5 => /usr/lib/x86_64-linux-gnu/libasan.so.5 > libiconv.so.2 => /home/jwalton/ok2delete-asan/bin/../lib/libiconv.so.2 > libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 > libtinfow.so.6 => /home/jwalton/ok2delete-asan/bin/../lib/libtinfow.so.6 > libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 > libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 > librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 > libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 > libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 > /lib64/ld-linux-x86-64.so.2 > > All of the warez built use the same RUNPATH. > > How do I tell GDB to use the RUNPATH set in the binary? > > Thanks in advance. > >From what I understand, the problem appears to be with the library required by GDB itself (GDB uses ncurses to implement the text user interface, or TUI) and not with ncurses loaded by your bash executable. As we can see by your ldd command, your bash doesn't even require ncurses. So maybe you built GDB against some ncurses library (the one in /usr/lib perhaps) but now there's another, incompatible ncurses library in the library path (in /usr/local/lib). Additionally, you get the error message just when loading the bash executable in GDB. At this point, GDB makes no attempt to load any of the shared libraries, that only happens when you run, and the process actually loads the shared libraries. And when this happens, GDB simply gets the absolute path of the library that the process actually loaded from the dynamic loader. As a result, GDB doesn't need to implement any RPATH / LD_LIBRARY_PATH / whatever logic to find libraries. Simon