Skip to content

Commit

Permalink
devtools: Fix verneed section parsing in pixie
Browse files Browse the repository at this point in the history
I misunderstood the ELF specification for version symbols (verneed):
The `vn_aux` pointer is relative to the main verneed record, not the
start of the section.

This caused many symbols to not be versioned properly in the return
value of `elf.dyn_symbols`. This was discovered in bitcoin#21454.

Fix it by correcting the offset computation.
  • Loading branch information
laanwj authored and rebroad committed Jun 28, 2021
1 parent 9f4da38 commit ddcc39d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/devtools/pixie.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def _parse_verneed(section: Section, strings: bytes, eh: ELFHeader) -> Dict[int,
result = {}
while True:
verneed = Verneed(data, ofs, eh)
aofs = verneed.vn_aux
aofs = ofs + verneed.vn_aux
while True:
vernaux = Vernaux(data, aofs, eh, strings)
result[vernaux.vna_other] = vernaux.name
Expand Down

0 comments on commit ddcc39d

Please sign in to comment.