Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistencies in data structures produced by Dyninst #1675

Open
batuzovk opened this issue Jan 12, 2024 · 2 comments
Open

Inconsistencies in data structures produced by Dyninst #1675

batuzovk opened this issue Jan 12, 2024 · 2 comments
Labels
bug parseAPI This issue is directly related to parseAPI user-reported This issue was reported by someone outside of the core Dyninst developers

Comments

@batuzovk
Copy link
Contributor

As the result of parsing a binary file Dyninst produces several entities and some relations between them. Among entities there are functions, blocks, and jump tables. Both blocks and jump tables can belong to a function (or to several functions). These relations are described by multiple data structures that should be kept in consistent state, namely:

  • For each function F from Block::getFuncs(), F should be in CodeObject::funcs() (i.e. it should 'exist' as a function).
  • For each function F and block B, F should be in B.getFuncs() iff B is in F.blocks().
  • For each jump table JT and function F, JT being in F.getJumpTables() should imply that JT.block is in F.blocks().

To Reproduce

  1. Get attached program verify.cc.gz that tests the conditions above. Build it with g++ -std=c++0x -g verify.cc -I/path/to/dyninst/include -L/path/to/dyninst/lib -lparseAPI -linstructionAPI -lsymtabAPI -ldynDwarf -ldynElf -lcommon -lelf -ldwarf -o verify
  2. Run on some sufficiently large guest binary file. Most common libraries produce at least some errors. libLLVM-17.so.1 for example, produces a lot.

Expected behavior
No inconsistencies found by the test program.

System (please complete the following information):

  • Linux, x86_64 for both host and guest.
  • Current master (commit cc5192e).

Additional notes
The most likely culprit is finalization. It changes function boundaries a lot, and I don't see a lot of code that fixes other data structures.

Also, block may not be part of the function that created it, but I'm not sure if this is intended or not.

@kupsch kupsch added bug parseAPI This issue is directly related to parseAPI user-reported This issue was reported by someone outside of the core Dyninst developers labels Jan 16, 2024
@hainest
Copy link
Contributor

hainest commented Feb 27, 2024

This was fixed by #1668, no?

@batuzovk
Copy link
Contributor Author

No? Why should it? It is a completely different issue. Reordering of functions doesn't affect those data structures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug parseAPI This issue is directly related to parseAPI user-reported This issue was reported by someone outside of the core Dyninst developers
Projects
None yet
Development

No branches or pull requests

3 participants