Skip to content

fix(lockdown): stabilize heartbeat, DDI, and profile services - #14

Open
truebit wants to merge 2 commits into
SideStore:developfrom
truebit:fix-upstream-lockdown-heartbeat-ddi
Open

fix(lockdown): stabilize heartbeat, DDI, and profile services#14
truebit wants to merge 2 commits into
SideStore:developfrom
truebit:fix-upstream-lockdown-heartbeat-ddi

Conversation

@truebit

@truebit truebit commented Aug 3, 2026

Copy link
Copy Markdown

Summary

This change primarily fixes connectivity failures on iOS 16 and earlier devices, where SideStore uses the Lockdown service path instead of Remote Pairing/RSD.

It addresses the minimuxer-side causes observed in:
SideStore/SideStore#1377

The reported symptoms included transient DDI Health Check failures and provisioning-profile operations failing with “Unable to Manage Profiles”.

Technical Details

  • Keep the Lockdown heartbeat service alive for the lifetime of the active minimuxer session.

  • Mark a Lockdown session ready only after completing a successful Marco/Polo heartbeat exchange.

  • Gate Lockdown DDI and provisioning-profile operations on heartbeat readiness. Remote Pairing/RSD operations continue to use their existing direct service path without starting a Lockdown heartbeat.

  • Introduce session-scoped child-service leases. Endpoint changes and foreground revalidation retire the current session, wait for in-flight operations to drain, and then start a new heartbeat session.

  • Preserve pending readiness waiters across endpoint-generation changes so a deferred DDI mount can continue after the replacement Lockdown session becomes ready.

  • Serialize DDI mount requests and track their generation. Health Check waits for the latest mount generation instead of observing a stale or transient mount result.

  • Derive the heartbeat receive timeout from the interval requested by the device, adding a five-second margin and capping the timeout at sixty seconds. This prevents a normal heartbeat cadence from being treated as a disconnect.

  • Revalidate the Lockdown session when SideStore returns to the foreground so tunnel or session loss can recover without restarting the app.

  • Recognize both Developer Disk Image response formats:

    • Legacy devices: /Developer with DiskImageType=Developer
    • Personalized images: /System/Developer with the personalized image schema
  • Explicitly reject entries reported with IsMounted=false.

Rationale

On Lockdown devices, DDI mounting and misagent profile operations could begin before the heartbeat service was ready. The heartbeat connection could also time out before the device’s next expected Marco message.

This created a race where Health Check temporarily reported a DDI error and profile installation failed even though the tunnel and application otherwise remained usable.

Remote Pairing uses RSD service connections and does not require this Lockdown heartbeat coordination, so that path remains intentionally separate.

Testing

Automated:

  • swift test: 7 tests passed
  • swift build --target Minimuxer: passed
  • SideStore Release iPhoneOS archive: passed

Manual testing:

  • iPhone 13 running iOS 16.0.2:

    • Lockdown Health Check
    • Legacy Developer Disk Image detection
    • Profile operations
    • App refresh and installation
  • iPhone 13 running iOS 17.5.1:

    • Remote Pairing/RSD Health Check
    • App refresh and installation
    • Regression coverage for the unchanged RSD path

Both device configurations passed manual testing.

truebit added 2 commits August 3, 2026 11:59
- Keep a persistent Lockdown heartbeat with bounded receive deadlines while leaving Remote Pairing on its existing RSD path.
- Serialize endpoint and foreground transitions so retiring sessions reject stale readiness and drain active DDI/profile leases before device state changes.
- Queue DDI mounts and profile operations behind heartbeat readiness, and coordinate replacement mounts so Health Check observes the latest device state.
- Reset the Lockdown runtime before pairing changes so repeated starts cannot leak heartbeat work into an RSP session.
- Recognize the pre-iOS 17 /Developer and DiskImageType=Developer response while retaining personalized DDI schema support.
- Respect explicit unmounted responses so Health Check does not accept stale image metadata.
- Add focused schema coverage and document the new domain and runtime layout.
@truebit
truebit force-pushed the fix-upstream-lockdown-heartbeat-ddi branch from 63f3d07 to b6cc70e Compare August 3, 2026 04:00
@truebit truebit changed the title fix(lockdown): stabilize child services on iOS 16 and earlier fix(lockdown): stabilize heartbeat, DDI, and profile services Aug 3, 2026
@truebit

truebit commented Aug 3, 2026

Copy link
Copy Markdown
Author

This PR is the upstream fix of LiveContainer#1

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