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

proc: adds pointer pinning to call injection #3787

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

aarzilli
Copy link
Member

This commit adds a new mode to call injection. If the runtime.debugPinner
function is available in the target executable it obtains a pinner by
calling it and then uses it to pin the pointers in the results of call
injection.

This allows the code for call injection to be refactored to execute the
calls in the normal order, since it doesn't need to be concerned with having
space on the target's memory to store intermediate values.

Updates #3310

@aarzilli aarzilli marked this pull request as draft July 30, 2024 17:44
@aarzilli aarzilli marked this pull request as ready for review August 6, 2024 12:50
pkg/proc/eval.go Outdated Show resolved Hide resolved
pkg/proc/eval.go Outdated Show resolved Hide resolved
pkg/proc/evalop/evalcompile.go Outdated Show resolved Hide resolved
pkg/proc/evalop/evalcompile.go Outdated Show resolved Hide resolved
pkg/proc/eval.go Outdated Show resolved Hide resolved
pkg/proc/evalop/evalcompile.go Show resolved Hide resolved
pkg/proc/dwarf_export_test.go Show resolved Hide resolved
pkg/proc/fncall.go Outdated Show resolved Hide resolved
pkg/proc/fncall.go Outdated Show resolved Hide resolved
pkg/proc/fncall.go Outdated Show resolved Hide resolved
@aarzilli
Copy link
Member Author

aarzilli commented Oct 1, 2024

There's a rare failure that seems to be happening with this changeset and windows, I want to investigate it before merging.

@aarzilli aarzilli force-pushed the fncallpinner2 branch 3 times, most recently from 1aa9e50 to d91f58d Compare October 4, 2024 15:14
This commit adds a new mode to call injection. If the runtime.debugPinner
function is available in the target executable it obtains a pinner by
calling it and then uses it to pin the pointers in the results of call
injection.

This allows the code for call injection to be refactored to execute the
calls in the normal order, since it doesn't need to be concerned with having
space on the target's memory to store intermediate values.

Updates go-delve#3310
@aarzilli
Copy link
Member Author

aarzilli commented Oct 4, 2024

There's a rare failure that seems to be happening with this changeset and windows, I want to investigate it before merging.

For the record: this issue was fixed. It was a preexisting issue exposed by this change where if we have to call injections happening simultaneously it's possible that when we resume execution of the target one of them will not make any progress (the other stops the process before the thread executing the first one is ever scheduled).

When that happened we didn't notice and assumed that both had progressed. The solution is to check for thread.SoftExc() so that we only take into consideration threads for which we received a breakpoint exception.

Copy link
Member

@derekparker derekparker left a comment

Choose a reason for hiding this comment

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

LGTM

@derekparker derekparker merged commit 025d47c into go-delve:master Oct 4, 2024
2 checks passed
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