From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id fiebNZkiAWKpMgAAWB0awg (envelope-from ) for ; Mon, 07 Feb 2022 08:46:01 -0500 Received: by simark.ca (Postfix, from userid 112) id CA9AE1F3C6; Mon, 7 Feb 2022 08:46:01 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [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 210F91EE1A for ; Mon, 7 Feb 2022 08:46:01 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5A528385841B for ; Mon, 7 Feb 2022 13:46:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A528385841B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1644241560; bh=x3cROyDp2ctYRLh959vwJjbDS79CVIIwwQn+tCBNY/c=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=R7Mour1nhFHBXTtRoVeo4sT6Bq2bCSJo/xjHCh46bbY0NjzGNtAP0eo7KW6uHWVdz aYYFwRWa8R6rIFL7SNYfvMTo+tYnW6b3mk/b06EoTqV5bUvMYrsvDRmKHItUcLMEhE OLYwqE391nifYIGVavbOxsdxV6o3urx1l+oPDLGg= Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by sourceware.org (Postfix) with ESMTPS id 6B13A3858D20 for ; Mon, 7 Feb 2022 13:45:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6B13A3858D20 Received: by mail-lj1-x22b.google.com with SMTP id z7so19680946ljj.4 for ; Mon, 07 Feb 2022 05:45:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=x3cROyDp2ctYRLh959vwJjbDS79CVIIwwQn+tCBNY/c=; b=gfQCZClo6NYnlnkOTE9KSgXFVNrspl26XCONAQLyvtTvE1OMLn92DjijYOIJGsB9V0 NM6LHWoX8x6PGuG9Gb/0B/INBoFPEN81ChLDMhO28kTFe4P4YmW5TYfH10NNCC9MiRHq buqOrodIlLpf9zOnOpqgismG6Wa8t8DWnCWIkzbrH205yP+oz4juz9hy/Jr30TDkxe0y F8342dFBeR2hF/IdfBQ3Cj8gjnxgfVx1rduPUcGy9m/4GvKMudJKAv2HUxelWJCzg8zo 9V6XFBFRkOwgZL7Y/AGX0hLnxSslSR+s+lOvg+3FmVCYMCkK6CPPm+lgCipe257nATo7 GW2A== X-Gm-Message-State: AOAM533/Ym50x/bNu01fnZph21b1mekmk5bGPF7ja0LJmDtooFrCqAeZ 7OR8jBtk2tUSJ6kZicvcfBU= X-Google-Smtp-Source: ABdhPJwsyPWvdM/yVFutpdN+D+U7/+EagVesSCPcZsnKOYsVa9l+XRnUgPdsR/qKq35hyyoBJ94x/A== X-Received: by 2002:a2e:7c0c:: with SMTP id x12mr9010303ljc.526.1644241532136; Mon, 07 Feb 2022 05:45:32 -0800 (PST) Received: from [192.168.10.175] (37-247-29-68.customers.ownit.se. [37.247.29.68]) by smtp.gmail.com with ESMTPSA id u26sm1501136lfi.307.2022.02.07.05.45.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Feb 2022 05:45:31 -0800 (PST) Message-ID: Date: Mon, 7 Feb 2022 14:45:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: Debugging ld.so in gdb Content-Language: en-US To: Florian Weimer , cltang@codesourcery.com, adhemerval.zanella@linaro.org 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> <878ruqo8o2.fsf@oldenburg.str.redhat.com> <8d9d02de-1a59-1f4d-dbcf-050b65abef29@gmail.com> <93cd41d6-e333-f31e-96bb-2f34a88f164f@gmail.com> <875ypqc2ma.fsf@oldenburg.str.redhat.com> <3e08e7c7-05f5-16f2-50cb-036687386997@gmail.com> <87wni6amk5.fsf@oldenburg.str.redhat.com> <4ea94b1b-71f5-3fbe-e18d-dff61ba3d835@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: Jacob Kroon via Gdb Reply-To: Jacob Kroon Cc: Jacob Kroon via Gdb Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" On 2/7/22 14:39, Jacob Kroon wrote: > On 2/7/22 13:32, Jacob Kroon wrote: >> On 2/7/22 13:27, Florian Weimer wrote: >>> * Jacob Kroon: >>> >>>>> What I find really confusing is that this is not the result of a dlopen >>>>> call. I definitely would expect that the maps array contains *all* >>>>> objects that are being loaded. Clearly this is not the case here. >>>>> Somehow certain objects are missing, and then they get written into the >>>>> rpo array. >>>>> >>>>> Please try to find libjvm.so among the l_initfini arrays of the objects. >>>> >>>> I do find libjvm.so in a couple of the maps[]->l_initfini[]->l_name >>>> arrays, yes. >>> >>> Okay, and of course there is an assumption that those make it to the >>> maps. No wonder we run off the array. >>> >>>>> It must be present somewhere. I assume it's also on the main list, >>>>> which starts off at _rtld_global._dl_ns[0]._ns_loaded. >>>> >>>> Hmm how do I iterate over that data structure ? >>>> >>>> See below: >>>>> (gdb) print _rtld_global._dl_ns[0]._ns_loaded[0]->l_name >>>>> $186 = 0x7ffff7ff1d97 "" >>>>> (gdb) print _rtld_global._dl_ns[0]._ns_loaded[1]->l_name >>>>> $187 = 0x0 >>>>> (gdb) print _rtld_global._dl_ns[0]._ns_loaded[2]->l_name >>>>> $188 = 0x0 >>>>> (gdb) print _rtld_global._dl_ns[0]._ns_loaded->l_name >>>>> $189 = 0x7ffff7ff1d97 "" >>>>> (gdb) print _rtld_global._dl_ns[1]._ns_loaded->l_name >>>>> Cannot access memory at address 0x8 >>>>> (gdb) print _rtld_global._dl_ns[2]._ns_loaded->l_name >>>>> Cannot access memory at address 0x8 >>> >>> It's a list chained by l_prev/l_next. >>> >> >> Ok, yes "libjvm.so" is there, in multiple entries. >> > > I managed to build glibc master, and yes it also crashes. Reverting the > suspicious commit: > > commit 15a0c5730d1d5aeb95f50c9ec7470640084feae8 > Author: Chung-Lin Tang > Date: Thu Oct 21 21:41:22 2021 +0800 > > elf: Fix slow DSO sorting behavior in dynamic loader (BZ #17645) > > fixes the crash. Adding a couple of more people. > And yes, using master (or host) glibc and running: $ GLIBC_TUNABLES="glibc.rtld.dynamic_sort=1" ldd mylib.so also works without crashing. Jacob