HexHive / HexHive/retrowrite

issues with handling aliased symbols

Open
#17 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
750
Forks
87
PR merge metrics
No merged PRs in 30d

Description

Hi,

The current version of retrowrite may not properly handle aliased symbols.

An object, such as a function, can have multiple aliased symbols. However, the loading process at https://github.com/HexHive/retrowrite/blob/master/librw/loader.py#L124 just picks the last one. This can cause problems because other references to the same object use the symbol linked to the relocation (e.g., https://github.com/HexHive/retrowrite/blob/master/librw/rw.py#L185) --- the symbol picked by the loading process and the symbol linked to the relocation can be different, though they are aliases.

A safer strategy is to keep all aliased symbols in the assembly file by using the ".set" primitive.

I have committed a tentative "patch" to the repo I forked locally: https://github.com/junxzm1990/retrowrite.

FYI, a tentative "patch" to the naming issues of global symbols I mentioned at https://github.com/HexHive/retrowrite/issues/15 is also committed to my local repo.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read the symbol-loading logic at librw/loader.py:124 and the relocation reference handling at librw/rw.py:185. Verify how multiple aliased symbols are selected, then preserve all aliases in the generated assembly with the .set primitive so relocation-linked references remain valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
reverse-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.