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

Implement automated binary re-relativization for AArch32 and AArch64 #4016

Open
derekbruening opened this issue Jan 14, 2020 · 3 comments
Open

Comments

@derekbruening
Copy link
Contributor

derekbruening commented Jan 14, 2020

Xref related issues: #731, #3271, #3339
This issue covers implementing automated binary re-relativization of AArch32 and AArch64 instructions. We will need a different strategy than the x86 approach of storing the location of a 32-bit immediate, due to the varying immediate encodings. For now, decode_from_copy() invalidates the raw bits to force a re-encoding as a workaround for not having this feature.

@johnfxgalea
Copy link
Contributor

Just checking, but this issue is still only a concern when DR is used in standalone mode right? (in relation to #731) Or are there mangling issues which were recently discovered please?

@derekbruening
Copy link
Contributor Author

This does not impact core DR's basic operations, no. It impacts someone using decode_from_copy() or other decoding operations, which could be standalone or in a client. The workaround of forcing re-encode should ensure there are no problems today except when we have parts of an instr that are not recorded and not recreated on that re-encode: such as this case which we hit recently: #4017.

derekbruening added a commit that referenced this issue Jan 15, 2020
Adds rip-relative information tracking at IR levels 1-3 for
instruction references on x86, extending the existing tracking for
data references.

Adds decode_sizeof_ex() and instr_get_rel_data_or_instr_target() to
support rip-relative displacement and target handling.

Changes decode_from_copy() to preserve raw bits for all instructions,
eliminating problems where untracked encoding features are lost such
as in #4017.

Documents the changes and describes how to avoid the new behavior.
Does just that for intra-sequence cti's in the rseq native code copy.

Adds test cases to api.ir.

Implementing the same thing for AArchXX is left unimplemented, tracked
by i#4016.

Issue: #731, #3271, #3339, #4016, #4017
Fixes #731
Fixes #3271
Fixes #4017
derekbruening added a commit that referenced this issue Jan 16, 2020
Adds rip-relative information tracking at IR levels 1-3 for
instruction references on x86, extending the existing tracking for
data references.

Adds decode_sizeof_ex() and instr_get_rel_data_or_instr_target() to
support rip-relative displacement and target handling.

Changes decode_from_copy() to preserve raw bits for all instructions,
eliminating problems where untracked encoding features are lost such
as in #4017.

Documents the changes and describes how to avoid the new behavior.
Does just that for intra-sequence cti's in the rseq native code copy and
Windows syscall wrapper copies.

Adds test cases to api.ir.

Implementing the same thing for AArchXX is left unimplemented, tracked
by i#4016.

Issue: #731, #3271, #3339, #4016, #4017
Fixes #731
Fixes #3271
Fixes #4017
@AssadHashmi AssadHashmi self-assigned this Jan 17, 2020
@derekbruening
Copy link
Contributor Author

This is causing loss of encoding fidelity for cases like #7132.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants