Repository navigation
runtime: release task and copied values in entitlement checks - #473
Open
Jelly-RayTian wants to merge 6 commits into
Open
Jelly-RayTian wants to merge 6 commits into
Jelly-RayTian wants to merge 6 commits into
Conversation
Signed-off-by: Jelly-RayTian <285009427+Jelly-RayTian@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Every
checkAppEntitlementcall creates a SecTask and never releases it, including the missing-entitlement early return.LibraryStatus.updatepollsEntitlementStatus.check()every two seconds, which makes three such queries. The leak is small per query but accumulates across status polling and other checks.Balance the task's Create ownership with a defer, and express the manually declared Copy API's retained result as
Unmanaged<CFTypeRef>consumed bytakeRetainedValue(). Boolean interpretation, absent/error results, UI status and signing permissions remain unchanged. Apple documents caller ownership for both SecTaskCreateFromSelf and SecTaskCopyValueForEntitlement.Validation:
python3 tests/host/check-entitlement-lifetimes.pycompiles the actual checker and calls the real macOS Security.framework 2,000 times with an absent entitlement, draining autorelease pools. The unchanged base reports 2,000 SecTask leaks / 192,000 bytes; this patch reports 0 leaks / 0 bytes via Apple'sleaks --atExit. The Boolean result remains false. No mocked task/allocator, certificate or provisioning profile is used. The regression targets the demonstrated missing-value task leak; present-value ownership follows the Copy API's documented contract.git diff --checkpasses.This was found while investigating reported launch/signing-status issues. It does not grant Memory+, change JIT detection, fix Astroneer's configuration timeout (#457), or establish the cause of any game/device termination. No real iPad run is claimed.
Based directly on the #461 runtime branch (
54fc65ae), independently of #471 and #472. AI-assisted implementation and native host verification.