cmux NEXT: acpmux checked line never blocks main behind a socket send; lint dlopen and whole-file signature checks
Split from #22814: the parts that need no person. The acpmux trust cache and the updater rollback stay in #22814, which waits for an approving review.
- Cross-process timeout (class 4):
AcpmuxCheckedLine.personProofhas main-actor callers (AcpmuxPersonLine,AcpmuxPermissionFeedBridge,MobileHostApproverSync). It read its state withqueue.syncon the queue that does a blockingsendwith no send timeout, so if acpmux stopped reading, the main thread waited forever. It now reads an atomic, and the socket hasSO_SNDTIMEO5 s. A peer that stops reading ends the connection. - Lint (class 1):
check-concurrency.shrequires a reviewed// concurrency-allow:fordlopen(andSecStaticCodeCheckValidity(.dlopenholds dyld's loader lock, and every main-threaddlopenordladdrwaits on it, even when the load runs on another thread. This caused the CEF launch hang fixed in #22813.- Static signature validation hashes the whole file.
- Each existing site states its thread. The two real main-thread sites (
AcpmuxServerPeer.swiftandUpdateDropBack.swift) are KNOWN pending entries that #22814 removes. SimulatorKitRuntimeis a KNOWN one-time stall at the first live simulator screen.
The review findings from #22814 apply here: the regex catches Darwin.dlopen and dlopen (, and the CEF allow reasons name the dead startBlocking path.
Changelog
none
Observed / Not run
- Observed: check-concurrency ok; prepush-gate no new violations; cmux-ci step (see comment) compiles CmuxNext with tests and runs AcpmuxLaunchSecurityTests and AcpmuxRefusedDaemonTests. The same AcpmuxCheckedLine change passed step 3376fe7661a1 inside #22814.
- Not run: a live acpmux peer that stops reading.
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Prevents AcpmuxCheckedLine.personProof from blocking the main thread behind a socket send: it read its state with queue.sync on a queue whose blocking send had no timeout, so a peer that stopped reading hung the main thread forever. It now reads an atomic, and the socket has SO_SNDTIMEO 5 s, so a stalled peer ends the connection. check-concurrency.sh now also requires a reviewed // concurrency-allow: comment for dlopen( and SecStaticCodeCheckValidity(.
Lint
dlopenholds dyld's loader lock; every main-threaddlopenordladdrwaits on it even when the load runs on another thread. This caused the CEF launch hang fixed in #22813.SecStaticCodeCheckValidityhashes the whole file, so it must never run on the main thread.- Existing sites now name their thread; the two main-thread sites are KNOWN pending entries that #22814 removes.