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 10D053858D28 for ; Tue, 2 May 2023 07:58:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 10D053858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683014283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OSVIv8sZ7RSbYxs6dQ6cQ6O9DhogyMmEOfaewUp+WNA=; b=Ye8UyFNQIpkhy7TeZWRnXTkRpahl76sk/l7f2331x7BlKCEct4eP258bJkHsMo4Ut/ZmEb XwVgKd4jJ3gr1MchxElYnFEauV4uuE4Hc1zo74I60EfS4+5GM7naitl+GOzbIUqlooSjR6 T1dY3bSVTC3DRDQXNqDEXEQA73BsFC8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-539-LC6O2F6kMlmKB4JzsFXjvQ-1; Tue, 02 May 2023 03:58:02 -0400 X-MC-Unique: LC6O2F6kMlmKB4JzsFXjvQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C2202A0F386; Tue, 2 May 2023 07:58:01 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 559A240C6E68; Tue, 2 May 2023 07:58:01 +0000 (UTC) From: Florian Weimer To: Luke Diamand via Elfutils-devel Cc: Luke Diamand Subject: Re: Hitting g dwfl->lookup_elts limit in report_r_debug, so not all modules show up and backtracing fails References: Date: Tue, 02 May 2023 09:57:59 +0200 In-Reply-To: (Luke Diamand via Elfutils-devel's message of "Tue, 25 Apr 2023 19:00:42 +0000") Message-ID: <87y1m7tbaw.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Luke Diamand via Elfutils-devel: > I've got a few cores where report_r_debug() in link_map.c fails to > find all of the modules - for example I had libc.so missing. This > obviously meant that elfutils could not backtrace my core. > > It seems to be related to this code: > > /* There can't be more elements in the link_map list than there are > segments. DWFL->lookup_elts is probably twice that number, so it > is certainly above the upper bound. If we iterate too many times, > there must be a loop in the pointers due to link_map clobberation. */ > size_t iterations = 0; > > while (next != 0 && ++iterations < dwfl->lookup_elts) > > I've changed this to just keep going until it reaches > dwfl->lookup_elts*5, which seems to "fix" it, but I feel there must be > a better fix! > > The most recent core I saw with this had lookup_elts=36, and hit 109 > iterations of the loop and then backtraced just fine. It's probably another fallout from -z separate-code, which tends to create four LOAD segments. The magic number 5 sounds about right, as gold also has -z text-unlikely-segment, which might result in creating that number of load segments (but I haven't tried). Thanks, Florian