Skip to content

swift-inspect: ensure that we eject any injected code #67396

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

Merged
merged 1 commit into from
Jul 20, 2023

Conversation

compnerd
Copy link
Member

We would previously fail to eject the injected code on a failure. This would prevent a future introspection into the process as well as leave the file open with an incremented retain count in the kernel space which would prevent the file from being deleted.

In the future, when the application is able to treat the injected code as a resource, this resource would be temporarily extracted, but would no longer be possible to delete until a reboot (with a registration of the deletion) due to the retained code.

@compnerd
Copy link
Member Author

CC: @hjyamauchi

We would previously fail to eject the injected code on a failure.  This
would prevent a future introspection into the process as well as leave
the file open with an incremented retain count in the kernel space which
would prevent the file from being deleted.

In the future, when the application is able to treat the injected code
as a resource, this resource would be temporarily extracted, but would
no longer be possible to delete until a reboot (with a registration of
the deletion) due to the retained code.

Take the opportunity to rename some functions to take advantage of
labelled parameters and trailing function syntax.  This makes the code a
small amount easier to read.
@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test macOS platform

Copy link
Contributor

@hjyamauchi hjyamauchi left a comment

Choose a reason for hiding this comment

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

Nice!

@compnerd compnerd merged commit 8c9d12c into swiftlang:main Jul 20, 2023
@compnerd compnerd deleted the ejection branch July 20, 2023 14:14
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