<feed xmlns='http://www.w3.org/2005/Atom'>
<title>libusbmuxd/src, branch master</title>
<subtitle>A client library to multiplex connections from and to iOS devices</subtitle>
<link rel='alternate' type='text/html' href='https://cgit.libimobiledevice.org/libusbmuxd.git/'/>
<entry>
<title>inotify: use poll() instead of pselect() in usbmuxd_listen_inotify()</title>
<updated>2026-11-19T19:46:54+00:00</updated>
<author>
<name>Pavel Radzivilovsky</name>
</author>
<published>2026-11-19T19:46:54+00:00</published>
<link rel='alternate' type='text/html' href='https://cgit.libimobiledevice.org/libusbmuxd.git/commit/?id=1498dee3aadf66dbae10e699d71c62b428a511a3'/>
<id>1498dee3aadf66dbae10e699d71c62b428a511a3</id>
<content type='text'>
When usbmuxd isn't running, the device_monitor thread waits for the
socket to appear by select()ing on an inotify fd. In a long-lived
process with many open descriptors (e.g. KDE's kwin_wayland, which
loads libusbmuxd via Solid's iMobileDevice backend), that fd can be
&gt;= FD_SETSIZE (1024). FD_SET() on it is undefined behaviour, and with
_FORTIFY_SOURCE glibc aborts the whole process:

    *** bit out of range 0 - FD_SETSIZE on fd_set ***: terminated

    #8  __fortify_fail (libc)
    #9  usbmuxd_listen_inotify   src/libusbmuxd.c:944
    #10 device_monitor           src/libusbmuxd.c:1130

Here this took down the Wayland compositor (and with it the whole
desktop session) after ~4 weeks of uptime, when typing in the Overview
search triggered a KRunner plugin that initialised Solid.

poll() has no descriptor limit. This replaces the pselect() call with
poll() on the inotify fd and the wake pipe; the pselect() fallback shim
and the &lt;sys/select.h&gt; include become unused and are removed.
libimobiledevice-glue's socket code already uses poll() on non-Windows
platforms for the same reason.

Co-Authored-By: Claude Opus 5.5 &lt;noreply@anthropic.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When usbmuxd isn't running, the device_monitor thread waits for the
socket to appear by select()ing on an inotify fd. In a long-lived
process with many open descriptors (e.g. KDE's kwin_wayland, which
loads libusbmuxd via Solid's iMobileDevice backend), that fd can be
&gt;= FD_SETSIZE (1024). FD_SET() on it is undefined behaviour, and with
_FORTIFY_SOURCE glibc aborts the whole process:

    *** bit out of range 0 - FD_SETSIZE on fd_set ***: terminated

    #8  __fortify_fail (libc)
    #9  usbmuxd_listen_inotify   src/libusbmuxd.c:944
    #10 device_monitor           src/libusbmuxd.c:1130

Here this took down the Wayland compositor (and with it the whole
desktop session) after ~4 weeks of uptime, when typing in the Overview
search triggered a KRunner plugin that initialised Solid.

poll() has no descriptor limit. This replaces the pselect() call with
poll() on the inotify fd and the wake pipe; the pselect() fallback shim
and the &lt;sys/select.h&gt; include become unused and are removed.
libimobiledevice-glue's socket code already uses poll() on non-Windows
platforms for the same reason.

Co-Authored-By: Claude Opus 5.5 &lt;noreply@anthropic.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Convert network device address in conn_data to native sockaddr layout</title>
<updated>2026-11-17T23:32:05+00:00</updated>
<author>
<name>Nikias Bassen</name>
</author>
<published>2026-11-17T23:32:05+00:00</published>
<link rel='alternate' type='text/html' href='https://cgit.libimobiledevice.org/libusbmuxd.git/commit/?id=cf4b806dff1003e56b8219367bbb29cb01c3f619'/>
<id>cf4b806dff1003e56b8219367bbb29cb01c3f619</id>
<content type='text'>
usbmuxd reports the network address of a device as a BSD sockaddr
([sa_len][sa_family]...), even when it runs on a different OS than the
client (e.g. macOS usbmuxd reached over TCP from Linux). libusbmuxd passed
it through unchanged, so consumers casting conn_data to struct sockaddr
(like libimobiledevice) got the wrong family on Linux and Windows.

Convert the address when parsing it, so conn_data holds a native sockaddr
for the platform the library runs on. On macOS nothing changes, on the
other BSDs only the family value is adjusted.

iproxy and inetcat now use conn_data directly and require this version of
the library. The format is documented in usbmuxd.h.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
usbmuxd reports the network address of a device as a BSD sockaddr
([sa_len][sa_family]...), even when it runs on a different OS than the
client (e.g. macOS usbmuxd reached over TCP from Linux). libusbmuxd passed
it through unchanged, so consumers casting conn_data to struct sockaddr
(like libimobiledevice) got the wrong family on Linux and Windows.

Convert the address when parsing it, so conn_data holds a native sockaddr
for the platform the library runs on. On macOS nothing changes, on the
other BSDs only the family value is adjusted.

iproxy and inetcat now use conn_data directly and require this version of
the library. The format is documented in usbmuxd.h.
</pre>
</div>
</content>
</entry>
<entry>
<title>inotify (Linux): Wake device monitor via pipe instead of polling every second</title>
<updated>2026-11-17T13:57:56+00:00</updated>
<author>
<name>Nikias Bassen</name>
</author>
<published>2026-11-17T13:57:56+00:00</published>
<link rel='alternate' type='text/html' href='https://cgit.libimobiledevice.org/libusbmuxd.git/commit/?id=68779a6f0571a3486e329d2e55949b0eb0720af8'/>
<id>68779a6f0571a3486e329d2e55949b0eb0720af8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Validate packet and payload sizes in receive_packet</title>
<updated>2026-11-17T08:52:54+00:00</updated>
<author>
<name>Nikias Bassen</name>
</author>
<published>2026-11-17T08:52:54+00:00</published>
<link rel='alternate' type='text/html' href='https://cgit.libimobiledevice.org/libusbmuxd.git/commit/?id=ce85f4196cf627393e265020c96821b42a9381e1'/>
<id>ce85f4196cf627393e265020c96821b42a9381e1</id>
<content type='text'>
Credit to @PwnToday
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Credit to @PwnToday
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix hang in usbmuxd_events_unsubscribe() right after subscribing</title>
<updated>2026-11-15T14:12:49+00:00</updated>
<author>
<name>Sorvigolova</name>
</author>
<published>2026-10-21T16:56:59+00:00</published>
<link rel='alternate' type='text/html' href='https://cgit.libimobiledevice.org/libusbmuxd.git/commit/?id=e478ab408ed8db9003a25fe166e87237ba149dfd'/>
<id>e478ab408ed8db9003a25fe166e87237ba149dfd</id>
<content type='text'>
If usbmuxd_events_unsubscribe() is called before the device monitor
thread has connected to usbmuxd, listenfd is still -1, so there is
nothing to shut down. Where thread_cancel() is not available (Windows,
or builds without pthread_cancel) unsubscribe then relies on clearing
`running`, but device_monitor() sets `running = 1` and `cancelling = 0`
itself when it starts and overwrites that. The thread goes on to
connect, sends Listen and blocks in receive_packet() forever, so
thread_join() never returns.

This is easy to hit with ideviceinstaller on Windows with a network
device and redirected stdout: the command completes before
idevice_wait_for_command_to_complete() subscribes, so subscribe and
unsubscribe happen back to back and the tool hangs on exit.

Fix this by:
- initializing `running`/`cancelling` in usbmuxd_events_subscribe()
  under listener_mutex before the monitor thread is created;
- publishing listenfd in device_monitor() under the same mutex, and only
  if no cancellation was requested in the meantime (otherwise close the
  new socket and exit);
- setting `cancelling`/`running` and shutting down listenfd under the
  mutex in usbmuxd_events_unsubscribe(), and only if the socket exists.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If usbmuxd_events_unsubscribe() is called before the device monitor
thread has connected to usbmuxd, listenfd is still -1, so there is
nothing to shut down. Where thread_cancel() is not available (Windows,
or builds without pthread_cancel) unsubscribe then relies on clearing
`running`, but device_monitor() sets `running = 1` and `cancelling = 0`
itself when it starts and overwrites that. The thread goes on to
connect, sends Listen and blocks in receive_packet() forever, so
thread_join() never returns.

This is easy to hit with ideviceinstaller on Windows with a network
device and redirected stdout: the command completes before
idevice_wait_for_command_to_complete() subscribes, so subscribe and
unsubscribe happen back to back and the tool hangs on exit.

Fix this by:
- initializing `running`/`cancelling` in usbmuxd_events_subscribe()
  under listener_mutex before the monitor thread is created;
- publishing listenfd in device_monitor() under the same mutex, and only
  if no cancellation was requested in the meantime (otherwise close the
  new socket and exit);
- setting `cancelling`/`running` and shutting down listenfd under the
  mutex in usbmuxd_events_unsubscribe(), and only if the socket exists.
</pre>
</div>
</content>
</entry>
<entry>
<title>Improve portability by replacing OS-specific macros with AC_CHECK_FUNCS</title>
<updated>2025-11-06T19:05:29+00:00</updated>
<author>
<name>Masatake Daimon</name>
</author>
<published>2025-11-06T19:05:29+00:00</published>
<link rel='alternate' type='text/html' href='https://cgit.libimobiledevice.org/libusbmuxd.git/commit/?id=78d4e4c673dbc4bc70ed81fe096eb54b844f0030'/>
<id>78d4e4c673dbc4bc70ed81fe096eb54b844f0030</id>
<content type='text'>
The primary purpose of this change is to support NetBSD.
No functional changes intended.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The primary purpose of this change is to support NetBSD.
No functional changes intended.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove debug printf</title>
<updated>2025-01-01T00:04:24+00:00</updated>
<author>
<name>Nikias Bassen</name>
</author>
<published>2025-01-01T00:04:24+00:00</published>
<link rel='alternate' type='text/html' href='https://cgit.libimobiledevice.org/libusbmuxd.git/commit/?id=6ddeccc9aedffbd868b31a824064c38f784580e9'/>
<id>6ddeccc9aedffbd868b31a824064c38f784580e9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Use libusbmuxd_version() to construct client version string</title>
<updated>2024-12-30T13:10:11+00:00</updated>
<author>
<name>Nikias Bassen</name>
</author>
<published>2024-12-30T13:10:11+00:00</published>
<link rel='alternate' type='text/html' href='https://cgit.libimobiledevice.org/libusbmuxd.git/commit/?id=6b09092395181b88f5623c5859d74774b8b5565b'/>
<id>6b09092395181b88f5623c5859d74774b8b5565b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix build on Windows</title>
<updated>2024-12-02T05:12:43+00:00</updated>
<author>
<name>Nikias Bassen</name>
</author>
<published>2024-12-02T05:12:43+00:00</published>
<link rel='alternate' type='text/html' href='https://cgit.libimobiledevice.org/libusbmuxd.git/commit/?id=3fdaed78de8000af3b5d19d953eccd80a208ae2c'/>
<id>3fdaed78de8000af3b5d19d953eccd80a208ae2c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix compatibility with MSVC</title>
<updated>2024-11-29T03:27:50+00:00</updated>
<author>
<name>Duncan Ogilvie</name>
</author>
<published>2024-11-28T17:42:42+00:00</published>
<link rel='alternate' type='text/html' href='https://cgit.libimobiledevice.org/libusbmuxd.git/commit/?id=c3ca555266ff0f241f32a8e8fc2a3ccdae6623fe'/>
<id>c3ca555266ff0f241f32a8e8fc2a3ccdae6623fe</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
