Few cents about my commits

fix414: run/debug on ios13 device


History: errors when deploying to ios13 #414
Fix: PR416

Root case

libmobiledevice when locking services has to perform SSL handshake if required.
in iOS13 debugerserver started requiring this as well by including EnableServiceSSL in response:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

The weird thing is that after SSL handshake debug server service switches back to plain text communication over same underlayer socket. There was a try-fix in libmobiledevice to close SSL connection but it didn’t work. Root case of it is that it was trying close SSL connection by calling SSL_shutdown which sends close_notify shutdown to underlaying socket. But debugserver expects clear text GDP protocol communication and close_notify aren’t expected which causes gdp protocol error.
This issue was also discussed on libimobiledevice repo: issue789

The fix

It is enough just abandon SSL connection without using SSL_shutdown and just free all related resources. Corresponding fix was delivered to libimobiledevice as PR860, also PR859 was opened to deliver required TIMEOUT error code.
Meanwhile these contributions might not be included in master of libimobiledevice same fixes were delivered to MobiVM in form of patches and included in PR416

Other notes

Beside the fix itself PR416 delivers following changes:

  • updated to recent master of libimobiledevice
  • utilized debugserver api instead of service/device communication as it is already part of libimobiledevice and any fixes there will be automaticaly adopted;
  • libimobiledevice bindings were refreshed;
  • Method that finds Developer Image to mount was updated to allow using not exact one but matching major version (e.g. to allow mount ios13.0 image on ios13.1 device)