🍒[5.9][DiscardingTG] Undo pointer auth workaround; fix memory leaks #66103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
There are two leaks in the group.
"first error task leaks"
(a) the "the first error task that we RETAIN" and later on use to automatically re-throw the "first thrown by a child task error" task was not released;
"all values leak"
(b) due to the "hot fix" for pointer auth #65220 done for rdar://107574868 where we changed the signature of addTask from ()->() (what it must be), to ()->T in order to work around pointer-auth issues we introduced a leak and ALL "discarded" values would be leaking since we would not release that T value. The correct way to solve this is to undo this workaround and use correct pointer auth, which this PR does.
We must fix the method signature and undo the hack which #65223 was.
Risk: Medium; in order to fix this we must revert a signature change of the addTask parameter from
()->()
to()->T
introduced by a rushed fix for a pointer auth issue done for rdar://107574868 and bring it back to the correct()->T
; Not only is the->T
causing leaks, it also is semantically wrong and we should not have done such workaround but fixed pointer auth to begin with. Pointer auth is confirmed to be correct in this PR. The()->()
API did not ship in any shipping release yet, so this is the one/only moment to make it correct.Review by: @DougGregor @rjmccall
Testing: CI testing, verified pointer auth by building and testing on arm64e manually
Original PR: #65613
Radar: rdar://108829466