| Previous | Next |
| MACH_SEND_MSG_TOO_SMALL | MACH_SEND_INVALID_RIGHT |
MACH_SEND_INVALID_REPLY
Why the reply port matters
MACH_SEND_INVALID_REPLY concerns msgh_local_port, the field conventionally used as the reply port. A request can have a valid destination and still fail because its callback/reply right is null when the protocol requires one, has already been deallocated, belongs to the wrong task namespace, or is paired with an invalid disposition in msgh_bits.
Mach processes the header’s port rights atomically. When the same right is used in incompatible destination and reply roles, the kernel may report either destination or reply invalidity depending on the valid atomic interpretation. That is a design-level ownership issue, not a random race to be silenced with an unconditional retry.
Safe diagnosis
- Log both header port fields and their remote/local dispositions as one unit.
- Create and manage a reply port according to the API or MIG contract; do not reuse a port after giving away or deallocating the required right.
- Verify the server protocol: one-way messages should not populate a reply port merely by convention.
- Rebuild the whole header after recovery instead of changing only the port integer.
References
- Mach Kernel Interface Reference: mach_msg
- Apple XNU source: mach/message.h
- Apple Kernel Programming Guide: Mach overview
Looking for a different code? Search another status or error code.