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

bug: drreg restoration can overwrite changed values in inline instrumentation #58

Open
ndrewh opened this issue Jan 18, 2025 · 0 comments
Assignees
Labels
bug Something isn't working inline inline instrumentation compiler
Milestone

Comments

@ndrewh
Copy link
Owner

ndrewh commented Jan 18, 2025

Currently we before we commit the new register state we do something like this:

    drreg_unreserve_register(drcontext, bb, instr, op1_reg);
    drreg_unreserve_register(drcontext, bb, instr, op2_reg);
    drreg_restore_app_value(drcontext, bb, instr, op1_reg, op1_reg, false);
    drreg_restore_app_value(drcontext, bb, instr, op2_reg, op2_reg, false);

    exprbuilder_commit(builder, bb, instr, scratch_ptr_reg);

    drreg_unreserve_register(drcontext, bb, instr, scratch_ptr_reg);
    drreg_restore_app_value(drcontext, bb, instr, scratch_ptr_reg, scratch_ptr_reg, false);

The intention of this sequence is to ensure that the drreg restoration doesn't get inserted after we write the new register values. But nothing about unreserve or restore prevents drreg from later inserting another restoration. We should test this -- maybe we need to pass stateful=true to drreg_restore_app_value?

@ndrewh ndrewh added this to the 0.5 milestone Jan 18, 2025
@ndrewh ndrewh self-assigned this Jan 18, 2025
@ndrewh ndrewh added bug Something isn't working inline inline instrumentation compiler labels Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working inline inline instrumentation compiler
Projects
None yet
Development

No branches or pull requests

1 participant