Skip to content
Mach trap#-50

svc · mach trap -50

thread_get_special_reply_port

Returns the per-thread special reply port used by the kernel for sync-IPC priority inheritance.

Prototype

kern_return_t thread_get_special_reply_port(/* 0 args */);

Returns: kern_return_t

Version history

XNU tagmacOS#
xnu-4570.1.46macOS 10.13 High Sierra-50
xnu-4903.221.2macOS 10.14 Mojave-50
xnu-6153.11.26macOS 10.15 Catalina-50
xnu-7195.50.7.100.1macOS 11.0 Big Sur-50
xnu-8019.41.5macOS 12.0 Monterey-50
xnu-8792.41.9macOS 13.0 Ventura-50
xnu-10002.1.13macOS 14.0 Sonoma-50
xnu-11215.1.10macOS 15.0 Sequoia-50
xnu-11417.101.15macOS 15.4 Sequoia-50
xnu-12377.1.9macOS 26.0 Tahoe-50
xnu-10002.41.9-50
xnu-10002.61.3-50
xnu-10002.81.5-50
xnu-10063.101.15-50
xnu-10063.121.3-50
xnu-10063.141.1-50
xnu-11215.41.3-50
xnu-11215.61.5-50
xnu-11215.81.4-50
xnu-11417.121.6-50
xnu-11417.140.69-50
xnu-12377.101.15-50
xnu-12377.41.6-50
xnu-12377.61.12-50
xnu-12377.81.4-50
xnu-4570.20.62-50
xnu-4570.31.3-50
xnu-4570.41.2-50
xnu-4570.51.1-50
xnu-4570.61.1-50
xnu-4570.71.2-50
xnu-4903.231.4-50
xnu-4903.241.1-50
xnu-4903.270.47-50
xnu-6153.101.6-50
xnu-6153.121.1-50
xnu-6153.141.1-50
xnu-6153.41.3-50
xnu-6153.61.1-50
xnu-6153.81.5-50
xnu-7195.101.1-50
xnu-7195.121.3-50
xnu-7195.141.2-50
xnu-7195.60.75-50
xnu-7195.81.3-50
xnu-8019.61.5-50
xnu-8019.80.24-50
xnu-8020.101.4-50
xnu-8020.121.3-50
xnu-8020.140.41-50
xnu-8792.61.2-50
xnu-8792.81.2-50
xnu-8796.101.5-50
xnu-8796.121.2-50
xnu-8796.141.3-50

Notes

Special reply ports are lazily allocated, guarded receive rights pinned to a single thread; they let the kernel build a turnstile that boosts the server's scheduling priority for the duration of a synchronous RPC. libdispatch and libxpc fetch the port once per thread and reuse it across thousands of round-trips. Because the port is guarded with a context value, reusing it incorrectly (e.g. across thread migrations or after fork) raises an EXC_GUARD and terminates the process. The trap is also the building block for mach_msg2's sync-IPC fast path on macOS 12+.

Detection

Invisible to Endpoint Security; observable via DTrace mach_trap::thread_get_special_reply_port:entry. EXC_GUARD crashes referencing a special reply port appear in ReportCrash logs with exception code 0x4 (kGUARD_EXC_MOD_REFS) or 0x5 (kGUARD_EXC_INVALID_OPTIONS).

Related APIs

mach_reply_portmach_msg2_trap_kernelrpc_mach_port_guard_trapthread_self_trap