public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "mark at klomp dot org" <sourceware-bugzilla@sourceware.org>
To: elfutils-devel@sourceware.org
Subject: [Bug general/30975] elfutils incorrectly reports core files with non-contiguous segments
Date: Thu, 21 Dec 2023 00:49:40 +0000	[thread overview]
Message-ID: <bug-30975-10460-fla7iHAReu@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30975-10460@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30975

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #8 from Mark Wielaard <mark at klomp dot org> ---
Fixed by this commit:

commit 2f38fa57942f95a9ada35e6802df864747c81cce
Author: Aaron Merey <amerey@redhat.com>
Date:   Tue Nov 21 08:56:44 2023 -0500

    libdwfl: Correctly handle corefile non-contiguous segments

    It is possible for segments of different shared libaries to be interleaved
    in memory such that the segments of one library are located in between
    non-contiguous segments of another library.

    For example, this can be seen with firefox on RHEL 7.9 where multiple
    shared libraries could be mapped in between ld-2.17.so segments:

          [...]
          7f0972082000-7f09720a4000 00000000 139264      /usr/lib64/ld-2.17.so
          7f09720a4000-7f09720a5000 00000000 4096        /memfd:mozilla-ipc
(deleted)
          7f09720a5000-7f09720a7000 00000000 8192        /memfd:mozilla-ipc
(deleted)
          7f09720a7000-7f09720a9000 00000000 8192        /memfd:mozilla-ipc
(deleted)
          7f0972134000-7f0972136000 00000000 8192       
/usr/lib64/firefox/libmozwayland.so
          7f0972136000-7f0972137000 00002000 4096       
/usr/lib64/firefox/libmozwayland.so
          7f0972137000-7f0972138000 00003000 4096       
/usr/lib64/firefox/libmozwayland.so
          7f0972138000-7f0972139000 00003000 4096       
/usr/lib64/firefox/libmozwayland.so
          7f097213a000-7f0972147000 00000000 53248      
/usr/lib64/firefox/libmozsqlite3.so
          7f0972147000-7f097221e000 0000d000 880640     
/usr/lib64/firefox/libmozsqlite3.so
          7f097221e000-7f0972248000 000e4000 172032     
/usr/lib64/firefox/libmozsqlite3.so
          7f0972248000-7f0972249000 0010e000 4096       
/usr/lib64/firefox/libmozsqlite3.so
          7f0972249000-7f097224c000 0010e000 12288      
/usr/lib64/firefox/libmozsqlite3.so
          7f097224c000-7f0972250000 00111000 16384      
/usr/lib64/firefox/libmozsqlite3.so
          7f0972250000-7f0972253000 00000000 12288      
/usr/lib64/firefox/liblgpllibs.so
          [...]
          7f09722a3000-7f09722a4000 00021000 4096        /usr/lib64/ld-2.17.so
          7f09722a4000-7f09722a5000 00022000 4096        /usr/lib64/ld-2.17.so

    dwfl_segment_report_module did not account for the possibility of
    interleaving non-contiguous segments, resulting in premature closure
    of modules as well as failing to report modules.

    Fix this by removing segment skipping in dwfl_segment_report_module.
    When dwfl_segment_report_module reported a module, it would return
    the index of the segment immediately following the end address of the
    current module.  Since there's a chance that other modules might fall
    within this address range, dwfl_segment_report_module instead returns
    the index of the next segment.

    This patch also fixes premature module closure that can occur in
    dwfl_segment_report_module when interleaving non-contiguous segments
    are found.  Previously modules with start and end addresses that overlap
    with the current segment would have their build-ids compared with the
    current segment's build-id.  If there was a mismatch, that module would
    be closed.  Avoid closing modules in this case when mismatching build-ids
    correspond to distinct modules.

    https://sourceware.org/bugzilla/show_bug.cgi?id=30975

    Signed-off-by: Aaron Merey <amerey@redhat.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

      parent reply	other threads:[~2023-12-21  0:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 14:04 [Bug general/30975] New: " pablogsal at gmail dot com
2023-11-02 13:48 ` [Bug general/30975] " mark at klomp dot org
2023-11-02 13:55 ` pablogsal at gmail dot com
2023-11-12 20:19 ` amerey at redhat dot com
2023-11-13 16:21 ` amerey at redhat dot com
2023-11-21 18:26 ` amerey at redhat dot com
2023-11-23 14:51 ` pablogsal at gmail dot com
2023-11-23 15:10 ` amerey at redhat dot com
2023-12-21  0:49 ` mark at klomp dot org [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:
  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=bug-30975-10460-fla7iHAReu@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --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).