Skip to content
Mach trap#-24

svc · mach trap -24

_kernelrpc_mach_port_construct_trap

Trap-level entry point that backs mach_port_construct — atomically creates a port with optional guard, queue limit, and other attributes.

Prototype

kern_return_t _kernelrpc_mach_port_construct_trap(/* 4 args */);

Returns: kern_return_t

Version history

XNU tagmacOS#
xnu-2422.115.4macOS 10.9 Mavericks-24
xnu-2782.40.9macOS 10.10 Yosemite-24
xnu-3247.1.106macOS 10.11 El Capitan-24
xnu-3789.1.32macOS 10.12 Sierra-24
xnu-4570.1.46macOS 10.13 High Sierra-24
xnu-4903.221.2macOS 10.14 Mojave-24
xnu-6153.11.26macOS 10.15 Catalina-24
xnu-7195.50.7.100.1macOS 11.0 Big Sur-24
xnu-8019.41.5macOS 12.0 Monterey-24
xnu-8792.41.9macOS 13.0 Ventura-24
xnu-10002.1.13macOS 14.0 Sonoma-24
xnu-11215.1.10macOS 15.0 Sequoia-24
xnu-11417.101.15macOS 15.4 Sequoia-24
xnu-12377.1.9macOS 26.0 Tahoe-24
xnu-10002.41.9—-24
xnu-10002.61.3—-24
xnu-10002.81.5—-24
xnu-10063.101.15—-24
xnu-10063.121.3—-24
xnu-10063.141.1—-24
xnu-11215.41.3—-24
xnu-11215.61.5—-24
xnu-11215.81.4—-24
xnu-11417.121.6—-24
xnu-11417.140.69—-24
xnu-12377.101.15—-24
xnu-12377.41.6—-24
xnu-12377.61.12—-24
xnu-12377.81.4—-24
xnu-2422.1.72—-24
xnu-2422.100.13—-24
xnu-2422.110.17—-24
xnu-2422.90.20—-24
xnu-2782.1.97—-24
xnu-2782.10.72—-24
xnu-2782.20.48—-24
xnu-2782.30.5—-24
xnu-3247.10.11—-24
xnu-3248.20.55—-24
xnu-3248.30.4—-24
xnu-3248.40.184—-24
xnu-3248.50.21—-24
xnu-3248.60.10—-24
xnu-3789.21.4—-24
xnu-3789.31.2—-24
xnu-3789.41.3—-24
xnu-3789.51.2—-24
xnu-3789.60.24—-24
xnu-3789.70.16—-24
xnu-4570.20.62—-24
xnu-4570.31.3—-24
xnu-4570.41.2—-24
xnu-4570.51.1—-24
xnu-4570.61.1—-24
xnu-4570.71.2—-24
xnu-4903.231.4—-24
xnu-4903.241.1—-24
xnu-4903.270.47—-24
xnu-6153.101.6—-24
xnu-6153.121.1—-24
xnu-6153.141.1—-24
xnu-6153.41.3—-24
xnu-6153.61.1—-24
xnu-6153.81.5—-24
xnu-7195.101.1—-24
xnu-7195.121.3—-24
xnu-7195.141.2—-24
xnu-7195.60.75—-24
xnu-7195.81.3—-24
xnu-8019.61.5—-24
xnu-8019.80.24—-24
xnu-8020.101.4—-24
xnu-8020.121.3—-24
xnu-8020.140.41—-24
xnu-8792.61.2—-24
xnu-8792.81.2—-24
xnu-8796.101.5—-24
xnu-8796.121.2—-24
xnu-8796.141.3—-24

Notes

Where mach_port_allocate yields a bare receive right, mach_port_construct takes a mach_port_options_t describing port-set membership, queue limit, context, no-senders subscription, importance-inheritance behavior, and an optional guard value. The atomicity matters: it eliminates the TOCTOU window between allocation and configuration that previously required several traps and exposed half-configured ports to other threads. libxpc, libdispatch, and modern XPC services use it almost exclusively for new receive rights.

Detection

DTrace mach_trap::_kernelrpc_mach_port_construct_trap:entry is the only direct probe; the trap is invisible to Endpoint Security. The MPO_CONTEXT_AS_GUARD and MPO_STRICT flags in the options struct are useful signals when reverse-engineering hardened daemons.

Related APIs

_kernelrpc_mach_port_destruct_trap_kernelrpc_mach_port_allocate_trap_kernelrpc_mach_port_guard_trapmach_port_construct