public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Luke Diamand <ldiamand@roku.com>
To: "elfutils-devel@sourceware.org" <elfutils-devel@sourceware.org>
Subject: Hitting g dwfl->lookup_elts limit in report_r_debug, so not all modules show up and backtracing fails
Date: Tue, 25 Apr 2023 19:00:42 +0000	[thread overview]
Message-ID: <SN6PR01MB4285597A6BD3DA04814924BCB0649@SN6PR01MB4285.prod.exchangelabs.com> (raw)

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.

Thanks!
Luke


             reply	other threads:[~2023-04-25 19:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25 19:00 Luke Diamand [this message]
2023-05-02  7:57 ` Florian Weimer
2023-05-08 16:35   ` Mark Wielaard
2023-05-12 16:55     ` [EXTERNAL] " Luke Diamand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SN6PR01MB4285597A6BD3DA04814924BCB0649@SN6PR01MB4285.prod.exchangelabs.com \
    --to=ldiamand@roku.com \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).