Skip to content

Fix XPC file handle ownership#1928

Open
fallintoplace wants to merge 1 commit into
apple:mainfrom
fallintoplace:agent/xpc-fd-ownership
Open

Fix XPC file handle ownership#1928
fallintoplace wants to merge 1 commit into
apple:mainfrom
fallintoplace:agent/xpc-fd-ownership

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

  • Make file handles returned by XPCMessage own their duplicated descriptors.
  • Keep caller-owned FileHandle values open when adding them to an XPC message.
  • Close the unused log descriptor in the container and machine log commands.
  • Add repeated log/dial descriptor lifetime tests.

xpc_fd_create duplicates its input descriptor, so the setters do not need to consume the caller's FileHandle. The getters also duplicate descriptors; making the returned handles close on deallocation gives those descriptors a clear owner and prevents repeated log/dial operations from leaking them.

Validation

  • DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make test
  • Swift format lint
  • Hawkeye license check

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.

1 participant