This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Problems in dwfl_segment_report_module
- From: Ulf Hermann <ulf dot hermann at qt dot io>
- To: <elfutils-devel at sourceware dot org>
- Date: Wed, 10 May 2017 19:09:44 +0200
- Subject: Problems in dwfl_segment_report_module
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=qt.io;
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qtcompany.onmicrosoft.com; s=selector1-qt-io; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wYTYGg0/opnLW75a8eFVDMzUJCW424mLIsEJedZm3JI=; b=mthhyhLJrz1EVIZtgq34HDqtD++UVeR8U1+2h82XJaextOROwxIBfJ607oWiGUh6iqC+v3G72KWnyNp//O8N9yxaW+k6gnqEx9LonXgxs4cHdt7RM4AIFboRTrkE+/h7iU0asKJdAVZnUTnh9pnbjuReOjZUzTlu4TSgQhD94TE=
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Hi,
In dwfl_segment_report_module.c:657ff we have this heuristic to determine if an elf is invalid:
if ((module_end > module->start && module_start < module->end)
|| dyn_vaddr == module->l_ld)
{
if (module->elf != NULL
&& invalid_elf (module->elf, module->disk_file_has_build_id,
build_id, build_id_len))
{
elf_end (module->elf);
close (module->fd);
module->elf = NULL;
[...]
As far as I understand, module_start, module_end, module->start and module->end are the runtime mmap'd positions of the loaded elf file. The problem with this is that multiple elfs can be mmap'd on top of one another. That frequently happens. For example ld.so is always overwritten at some point. If we retrieve the positions of the overwritten mmaps from e.g. a core file, then we can attribute them to the wrong elf file, find that the build ID is "wrong" and discard the elf. This makes the run-backtrace-native-core.sh test fail for me in sometimes. linux-vdso.so is apparently mapped underneath backtrace-child and consequently backtrace-child gets discarded. Then we cannot unwind anything.
regards,
Ulf