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

(windows) Fixing RestoreRegisters() save register status to lcContext #75

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

0x7Fancy
Copy link
Contributor

Hello, a bug fix for the windows platform,

In windows/debugger.cpp#RestoreRegisters(), the target thread context should be restored using the passed register value;

When target program is a multi-threaded program. Using the following command can trigger bugs with a higher probability:

litecov.exe -instrument_module [module] -target_module [module] -target_method [method] -generate_unwind --[harness.exe]

When the bug is triggered, TinyInst usually receives a 0xC0000005 (access violation) exception from the target program; TinyInst treats this as a crash in the target program.

After further testing and analysis, I think that the bug will not be triggered in a single-threaded target program or when -generate_unwind is not used; In addition, in a multi-threaded target program, with -generate_unwind and without -target_module/-target_method, the bug will (maybe) not be triggered (TinyInst will complete instrumentation at the program entry, and this moment can be regarded as single-threaded Case?)

PS: macOS uses a similar implementation, but I think there is no problem with macOS’s implementation.

@ifratric ifratric merged commit 5a45ad4 into googleprojectzero:master Sep 28, 2023
@ifratric
Copy link
Collaborator

Thank you very much for the fix and analysis!

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

Successfully merging this pull request may close these issues.

2 participants