[DynInst_API:] [dyninst/dyninst] 8616bf: symtab: don't abort in findRegion on duplicate sam...


Date: Fri, 05 Jun 2026 20:12:28 -0700
From: bbiiggppiigg <noreply@xxxxxxxxxx>
Subject: [DynInst_API:] [dyninst/dyninst] 8616bf: symtab: don't abort in findRegion on duplicate sam...
  Branch: refs/heads/bbiiggppiigg/remove-findregion-assert
  Home:   https://github.com/dyninst/dyninst
  Commit: 8616bfd1f3656a0b77cec999e4e42f71254d5a42
      https://github.com/dyninst/dyninst/commit/8616bfd1f3656a0b77cec999e4e42f71254d5a42
  Author: wuxx1279 <bbiiggppiigg@xxxxxxxxx>
  Date:   2026-06-05 (Fri, 05 Jun 2026)

  Changed paths:
    M symtabAPI/src/Symtab-lookup.C

  Log Message:
  -----------
  symtab: don't abort in findRegion on duplicate same-(addr,size) sections

Symtab::findRegion(ret, addr, size) asserted that if two regions share an
identical (memOffset, memSize), at least one must be RT_BSS (or addr==0). That
assumption does not hold: GCC offload builds emit empty marker sections such as
.gnu.offload_funcs and .gnu.offload_vars at the *same* address with size 0, both
PROGBITS. On such a binary (observed on a CPU PyTorch libtorch_python.so) the
assertion aborts a debug-built dyninst during writeFile.

The abort is also unnecessary: the multiple-match case already reports
Multiple_Region_Matches and returns false, and callers handle that -- e.g.
emitElf's section loop falls back to findRegion-by-name, which is unambiguous.
In release builds the assert is compiled out and this already works; the fix
just makes debug builds behave the same.

Remove the assert and keep the existing graceful path (prefer a non-BSS match,
set Multiple_Region_Matches, return false). findRegion is library code reachable
from ordinary third-party binaries and should not abort() on valid input.

Co-Authored-By: Claude Opus 4.8 <noreply@xxxxxxxxxxxxx>



To unsubscribe from these emails, change your notification settings at https://github.com/dyninst/dyninst/settings/notifications
[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [dyninst/dyninst] 8616bf: symtab: don't abort in findRegion on duplicate sam..., bbiiggppiigg <=