Skip to content

usb: a broken transfer can be a lost reply on a pwned boot ROM - #170

Merged
henrikklee merged 1 commit into
OrchardLinux:mainfrom
17xande:usbliter8-linux-boot-reply
Dec 5, 2026
Merged

henrikklee merged 1 commit into
OrchardLinux:mainfrom
17xande:usbliter8-linux-boot-reply

Conversation

@17xande

@17xande 17xande commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

On Linux, orchard run --ibss on an iPhone XS Max (d331p) whose boot ROM a usbliter8 board entered stopped with:

error: DFU start on a pwned boot ROM: hardware fault or protocol violation

The patched iBSS had in fact started: the phone came up in recovery mode a few seconds later. The phone leaves USB in the middle of usbliter8's boot or finish request, and Linux reports that as a broken transfer (nusb TransferError::Fault, EPROTO), not as a disconnect. reply_may_be_lost took only a timeout, stall or disconnect as a lost reply.

This gives that failure its own kind, Kind::Fault, and lets reply_may_be_lost treat it as an unconfirmed reply. The image download before it still fails on any error. The macOS bring-up of the iPhone XR never hit this.

Tested on an iPhone XS Max from Linux (Arch, x86_64): RAM boots of hardware-check and two orchard install omarchy-a --ibss runs, the second of which is the installed system now running. With logging added for the test, the finish request ended once in Fault and twice in Disconnected, each time with the iBSS starting. cargo test -p orchard-usb: 84 passed.

Not fixed here: about one start in three, the iBSS hangs after the boot request (black screen, nothing on USB). The good and the hung starts look the same from the host, so that is still open.

On Linux, a device that leaves USB in the middle of a control request
can show as a broken transfer (nusb's TransferError::Fault, EPROTO)
rather than as a disconnect. usbliter8's boot request on an iPhone XS
Max ended that way while the iBSS started, and the ibss route stopped
with "DFU start on a pwned boot ROM: hardware fault or protocol
violation" although the patched iBoot came up in recovery mode a few
seconds later.

Give that failure its own kind, Fault, and let reply_may_be_lost take
it as an unconfirmed reply, as it takes a timeout, stall or
disconnect. The download before it still fails on any error.

Assisted-by: LLM
@henrikklee
henrikklee merged commit ba8eb6a into OrchardLinux:main Dec 5, 2026
11 checks passed
@henrikklee

Copy link
Copy Markdown
Contributor

Merged, thank you @17xande! A clear diagnosis (the iBSS had started; Linux just reported the phone leaving mid-request as a broken transfer instead of a disconnect), a narrow fix that gives that failure its own kind, and RAM boots plus two installs on the XS Max from Linux to back it up. Very nice.

What changed on the branch: nothing.

Follow-ups:

  • It ships with today's tools release.
  • Ashton's iPhone 5s pull request (ibss: take a protocol error as the boot ROM's new DFU session #166) hits the same Linux behaviour one step earlier; I'm narrowing it onto your new Kind::Fault so both paths treat exactly that case the same way.
  • The roughly one-in-three iBSS hang after the boot request that you describe stays open; if you can catch a serial or USB trace of a hung start, an issue with it would help a lot.

henrikklee added a commit to ashtonamory/tools that referenced this pull request Dec 5, 2026
Since OrchardLinux#170 a transfer that breaks off on the bus (Linux EPROTO, what
the iPhone 5s shows here) has its own kind, Kind::Fault. Take that and a
disconnect as the boot ROM leaving for its new session, rather than
every error without a kind of its own (Kind::Other).

Assisted-by: LLM
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.

2 participants