I would like to use my Linux system to charge up my iOS devices, but I don't want to "Trust this Computer" so maybe we can drill down further on this bug.
As soon as I connect a locked iDevice (tested iOS 9 and iOS 10):
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2184 root 20 0 348112 5596 4800 R 70.4 0.1 3886:07 upowerd
upowerd itself doesn't tell me much:
$ upower --monitor
Monitoring activity from the power daemon. Press Ctrl+C to cancel.
[15:26:55.169] device added: /org/freedesktop/UPower/devices/media_player_1_1
$ upower --monitor-detail
Monitoring activity from the power daemon. Press Ctrl+C to cancel.
[15:28:23.805] device added: /org/freedesktop/UPower/devices/media_player_1_1
native-path: /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1
vendor: Apple_Inc.
model: iPod
serial: 8b1d0ada9c849c62fd52263c3797034216608bf0
power supply: no
updated: Wed 31 Dec 1969 07:00:00 PM EST (1477682903 seconds ago)
has history: yes
has statistics: no
media-player
warning-level: none
percentage: 0%
icon-name: 'battery-missing-symbolic'
perf top: it shows the top four items to be libgmp.so.10.3.0 in:
__gmpn_redc_1
__gmpn_sqr_basecase
__gmpn_mul_basecase
__gmpz_probab_prime_p
`perf top --sort=comm,dso` shows that the top item is upowerd, in libgmp.so.10.3.0
This is a math library. I can only guess, but it may be doing math operations to compute the UDID of the iOS device every time it tries to communicate with it? Some SHA1 operations maybe.
To use strace on the upowerd process (PID 2184):
$ sudo strace -p 2184 -c
strace: Process 2184 attached
strace: [ Process PID=2184 runs in x32 mode. ]
strace: [ Process PID=2184 runs in 64 bit mode. ]
^Cstrace: Process 2184 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
58.05 0.000101 1 96 sendto
41.95 0.000073 0 14494 getrusage
0.00 0.000000 0 24 close
0.00 0.000000 0 30 6 stat
0.00 0.000000 0 6 poll
0.00 0.000000 0 96 select
0.00 0.000000 0 24 socket
0.00 0.000000 0 24 connect
0.00 0.000000 0 96 recvfrom
------ ----------- ----------- --------- --------- ----------------
100.00 0.000174 14890 6 total
$ sudo strace -p 2184 -e sendto -i
This shows that it is sending XML messages over and over again. For fuller output you can add `-s 999` ... these are XML formatted messages being sent to the iPod as part of some kind of iOS proprietary communications protocol.
You can verify using a USB capture via usbmon, that the host Linux system is in an infinite loop asking the iPod for something. Wireshark doesn't have a dissector for iOS vendor-specific interfaces and commands but you can see the same XML messages traveling the USB bus that were observed in strace.
Is this actually a bug in libimobiledevice ? This seems like a failure to obey an iOS protocol. Supposedly I am already on the latest version: my package is 1.2.0+dfsg-3~ubuntu0.2
I would like to use my Linux system to charge up my iOS devices, but I don't want to "Trust this Computer" so maybe we can drill down further on this bug.
As soon as I connect a locked iDevice (tested iOS 9 and iOS 10):
$ top
top - 12:22:28 up 24 days, 21:05, 2 users, load average: 0.50, 0.56, 0.84
Tasks: 222 total, 2 running, 220 sleeping, 0 stopped, 0 zombie
%Cpu(s): 37.7 us, 2.8 sy, 0.0 ni, 59.1 id, 0.5 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 3917996 total, 228612 free, 2176052 used, 1513332 buff/cache
KiB Swap: 4063228 total, 3597580 free, 465648 used. 1188276 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2184 root 20 0 348112 5596 4800 R 70.4 0.1 3886:07 upowerd
upowerd itself doesn't tell me much:
$ upower --monitor p/UPower/ devices/ media_player_ 1_1
Monitoring activity from the power daemon. Press Ctrl+C to cancel.
[15:26:55.169] device added: /org/freedeskto
$ upower --monitor-detail p/UPower/ devices/ media_player_ 1_1 pci0000: 00/0000: 00:14.0/ usb1/1- 1 2fd52263c379703 4216608bf0 missing- symbolic'
Monitoring activity from the power daemon. Press Ctrl+C to cancel.
[15:28:23.805] device added: /org/freedeskto
native-path: /sys/devices/
vendor: Apple_Inc.
model: iPod
serial: 8b1d0ada9c849c6
power supply: no
updated: Wed 31 Dec 1969 07:00:00 PM EST (1477682903 seconds ago)
has history: yes
has statistics: no
media-player
warning-level: none
percentage: 0%
icon-name: 'battery-
perf top: it shows the top four items to be libgmp.so.10.3.0 in: sqr_basecase mul_basecase probab_ prime_p
__gmpn_redc_1
__gmpn_
__gmpn_
__gmpz_
`perf top --sort=comm,dso` shows that the top item is upowerd, in libgmp.so.10.3.0
This is a math library. I can only guess, but it may be doing math operations to compute the UDID of the iOS device every time it tries to communicate with it? Some SHA1 operations maybe.
To use strace on the upowerd process (PID 2184):
$ sudo strace -p 2184 -c
strace: Process 2184 attached
strace: [ Process PID=2184 runs in x32 mode. ]
strace: [ Process PID=2184 runs in 64 bit mode. ]
^Cstrace: Process 2184 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
58.05 0.000101 1 96 sendto
41.95 0.000073 0 14494 getrusage
0.00 0.000000 0 24 close
0.00 0.000000 0 30 6 stat
0.00 0.000000 0 6 poll
0.00 0.000000 0 96 select
0.00 0.000000 0 24 socket
0.00 0.000000 0 24 connect
0.00 0.000000 0 96 recvfrom
------ ----------- ----------- --------- --------- ----------------
100.00 0.000174 14890 6 total
$ sudo strace -p 2184 -e sendto -i
This shows that it is sending XML messages over and over again. For fuller output you can add `-s 999` ... these are XML formatted messages being sent to the iPod as part of some kind of iOS proprietary communications protocol.
You can verify using a USB capture via usbmon, that the host Linux system is in an infinite loop asking the iPod for something. Wireshark doesn't have a dissector for iOS vendor-specific interfaces and commands but you can see the same XML messages traveling the USB bus that were observed in strace.
Is this actually a bug in libimobiledevice ? This seems like a failure to obey an iOS protocol. Supposedly I am already on the latest version: my package is 1.2.0+dfsg- 3~ubuntu0. 2