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

i#725: add attach for windows #5075

Merged
merged 218 commits into from
Sep 23, 2021

Conversation

OrBenPorath
Copy link
Contributor

Adding attach functionality on windows i#725.
Completing this PR.

Main difference from the original PR, is not taking over threads that are terminating (otherwise attach always fails).
Additionally, added the possibility to sleep 1 millisecond between takeover attempts, and controlling the number of attempts.

Feature marked as experimental.

@OrBenPorath OrBenPorath force-pushed the add-windows-attach branch 4 times, most recently from f5d4ce3 to c14ea01 Compare September 3, 2021 10:04
@derekbruening derekbruening self-requested a review September 3, 2021 17:48
core/CMakeLists.txt Outdated Show resolved Hide resolved
@OrBenPorath OrBenPorath force-pushed the add-windows-attach branch 11 times, most recently from 3ec1467 to 208fb7b Compare September 4, 2021 21:43
@derekbruening
Copy link
Contributor

OrBenPorath force-pushed the OrBenPorath:add-windows-attach branch 11 times

Please do not force push: it ruins the history, strands the review comments, etc. See https://dynamorio.org/page_code_reviews.html#sec_code_review_non_member and https://dynamorio.org/page_code_reviews.html#autotoc_md114. The final merge will squash it all down into one clean commit.

Copy link
Contributor

@derekbruening derekbruening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR. It looks pretty good: just some nits, and then the documentation and testing. Is your plan to add a test as a separate PR? And include some doc additions in this PR?

core/dynamo.c Outdated Show resolved Hide resolved
core/win32/injector.c Outdated Show resolved Hide resolved
core/win32/os.c Outdated Show resolved Hide resolved
core/win32/os.c Show resolved Hide resolved
tools/drdeploy.c Outdated Show resolved Hide resolved
@OrBenPorath
Copy link
Contributor Author

Thank you for the PR. It looks pretty good: just some nits, and then the documentation and testing. Is your plan to add a test as a separate PR? And include some doc additions in this PR?

My plan is to finish everything in this PR.

api/docs/deployment.dox Outdated Show resolved Hide resolved
api/docs/deployment.dox Show resolved Hide resolved
api/docs/deployment.dox Show resolved Hide resolved
@OrBenPorath
Copy link
Contributor Author

Ok, so the test is more stable now (I am not seeing the previous errors), but still fails sometimes.

I saw two errors:

  1. Nothing happens until the test times out.
  2. Test output missing 'MessageBox closed' before 'done':
118: starting attachee
118: thank you for testing attach
118: thread init
118: done

I don't understand these errors, but here are my thoughts:

  1. One of the first things attachee does is to write to the output file (that's the whole point), and nothing else is supposed to happen until it does, so how can it be empty?
  • Maybe the timeout is now less than the loops timeout, and we are not seeing anything because the process does not start, hence the pidfile is empty, and it is a different manifestation of the previous error.
  1. How is the target process terminated?
  • The run takes ~12 seconds. and does not output an error before comparing the outputs, so this is not a kill_background_process(ON) call.
  • The process does not output 'timed out' or 'MessageBox closed', so none of its threads initiated the termination.
  • Maybe the injection thread somehow terminated the process? Maybe it had an exception? I added prints on exception to have some more visibility if that is the case.

Unfortunately, I will not be available to work on this next week (and probably less available afterwards as well).
How do you want to continue?

@OrBenPorath
Copy link
Contributor Author

  1. How is the target process terminated?
  • The run takes ~12 seconds. and does not output an error before comparing the outputs, so this is not a kill_background_process(ON) call.
  • The process does not output 'timed out' or 'MessageBox closed', so none of its threads initiated the termination.
  • Maybe the injection thread somehow terminated the process? Maybe it had an exception? I added prints on exception to have some more visibility if that is the case.

But now it happened again, and there were no prints from the exception function.

What am I missing?

@derekbruening
Copy link
Contributor

Unfortunately, I will not be available to work on this next week (and probably less available afterwards as well).
How do you want to continue?

One way forward is to add this new test to the flaky ignore list in suite/runsuite_wrapper.pl (find the lists for the appropriate Windows bitwidth(s); put #725 in the comment), update #725 to say that the test still needs work and to be removed from the flaky list (o/w nobody will notice if attach gets broken and the test fails every time), and merge this in.

@derekbruening
Copy link
Contributor

add to whitelist

@derekbruening
Copy link
Contributor

run arm tests

@OrBenPorath
Copy link
Contributor Author

One way forward is to add this new test to the flaky ignore list in suite/runsuite_wrapper.pl (find the lists for the appropriate Windows bitwidth(s); put #725 in the comment), update #725 to say that the test still needs work and to be removed from the flaky list (o/w nobody will notice if attach gets broken and the test fails every time), and merge this in.

Added to flaky list - is it in the correct place?

Should I just comment on #725 something like
"Added in #5075.
Test still requires works, and to be removed from the flaky list."?

@derekbruening
Copy link
Contributor

One way forward is to add this new test to the flaky ignore list in suite/runsuite_wrapper.pl (find the lists for the appropriate Windows bitwidth(s); put #725 in the comment), update #725 to say that the test still needs work and to be removed from the flaky list (o/w nobody will notice if attach gets broken and the test fails every time), and merge this in.

Added to flaky list - is it in the correct place?

Yes, LGTM. (Huh the existing list for Windows is longer than I thought...need more devs to help clean it up.)

Should I just comment on #725 something like
"Added in #5075.
Test still requires works, and to be removed from the flaky list."?

SGTM, maybe pasting in the details of the failures you had above.

@derekbruening derekbruening merged commit a0a44a9 into DynamoRIO:master Sep 23, 2021
@derekbruening
Copy link
Contributor

Merged. Thank you for the PR, and working through all the debugging to get the test as far as it is!

@OrBenPorath
Copy link
Contributor Author

Merged. Thank you for the PR, and working through all the debugging to get the test as far as it is!

My pleasure :)
And thank you for DynamoRIO, it is amazing, and an honor to contribute to.

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