Skip to content

Fix a use-after-free with task tracing #41539

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 2 commits into from
Feb 25, 2022

Conversation

rjmccall
Copy link
Contributor

We cannot access the executed job after it has finished executing:

  • If it's a non-task job, it is always invalidated; such jobs are self-owning, and they are expected to destroy themselves after execution.

  • If it's a task, and it completes during execution, it will invalidate itself synchronously, e.g. by releasing itself. At this point, it must be assumed that the task memory has been releaed.

  • If it's a task, and it hasn't completed during execution, we are now racing with whatever event does complete the task.

Any information we want to log about the job must be recorded when it starts to run.

Fixes rdar://88817560

@rjmccall rjmccall requested a review from rokhinip February 24, 2022 08:14
@rjmccall
Copy link
Contributor Author

@swift-ci Please test

@rjmccall
Copy link
Contributor Author

@swift-ci Please test

We cannot access the executed job after it has finished executing:

- If it's a non-task job, it is always invalidated; such jobs are
  self-owning, and they are expected to destroy themselves after
  execution.

- If it's a task, and it completes during execution, it will invalidate
  itself synchronously, e.g. by releasing itself.  At this point, it
  must be assumed that the task memory has been releaed.

- If it's a task, and it hasn't completed during execution, we are
  now racing with whatever event *does* complete the task.

Any information we want to log about the job must be recorded when it
starts to run.

rdar://88817560
@rjmccall
Copy link
Contributor Author

@swift-ci Please test

@rjmccall
Copy link
Contributor Author

@swift-ci Please test Linux

@rokhinip rokhinip requested a review from mikeash February 24, 2022 21:56
@rokhinip
Copy link
Contributor

Adding Mike who added the tracing stuff

@rjmccall
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@rjmccall
Copy link
Contributor Author

@swift-ci Please test Linux

@rjmccall
Copy link
Contributor Author

@swift-ci Please test

@rjmccall
Copy link
Contributor Author

@swift-ci Please test macOS

@rjmccall
Copy link
Contributor Author

@swift-ci Please test Linux

@rjmccall
Copy link
Contributor Author

rjmccall commented Feb 25, 2022

Unrelated LLDB failure. This is getting tiresome.

@rjmccall
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@rjmccall rjmccall merged commit 9d1bf8f into swiftlang:main Feb 25, 2022
@rjmccall rjmccall deleted the uaf-task-tracing branch February 25, 2022 06:47
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.

3 participants