public inbox for
 help / color / mirror / Atom feed
From: Luke Diamand <>
Cc: Florian Weimer <>, Luke Diamand <>
Subject: [RFC PATCH 1/1] report_r_debug: handle `-z separate-code' and find more modules
Date: Fri, 12 May 2023 08:02:18 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Looking at some cores in eu-stack, I found that they were not being

This was because elfutils had not found some modules (e.g.
in report_r_debug.

That is because it has a limit on the number of link map entries it will
look at, to avoid loops in corrupted core files.

The example I found had:
- 36 elements
- 109 iterations

I have increased the limit, and this seems to solve the problem.

Florian Weimer suggested that the problem is caused by use of
`-z separate-code' although I have not yet managed to confirm this.

See also:

Signed-off-by: Luke Diamand <>
 libdwfl/link_map.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c
index 06d85eb6..975910a9 100644
--- a/libdwfl/link_map.c
+++ b/libdwfl/link_map.c
@@ -330,12 +330,13 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata,
   Dwfl_Module **lastmodp = &dwfl->modulelist;
   int result = 0;
-  /* 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.  */
+  /* Keep an upper bound on the number of iterations - 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)
+  while (next != 0 && ++iterations < dwfl->lookup_elts * 5)
       if (read_addrs (&memory_closure, elfclass, elfdata,
 		      &buffer, &buffer_available, next, &read_vaddr,

      reply	other threads:[~2023-05-12  7:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12  7:02 [RFC PATCH 0/1] In report_r_debug, iterate more segments Luke Diamand
2023-05-12  7:02 ` Luke Diamand [this message]

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:

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

  git send-email \ \ \ \ \

* 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).