Using the https://github.com/google/capsicum-test/ suite, the PosixMqueue.CapModeForked test was failing due to an ECAPMODE after calling kmq_notify(). On further inspection, the following code from sys/kern/uipc_mqueue.c initialized the dynamically loaded syscall entry with sy_flags zeroed out:
static struct syscall_helper_data mq_syscalls[] = {
SYSCALL_INIT_HELPER(kmq_open),
SYSCALL_INIT_HELPER(kmq_setattr),
SYSCALL_INIT_HELPER(kmq_timedsend),
SYSCALL_INIT_HELPER(kmq_timedreceive),
SYSCALL_INIT_HELPER(kmq_notify),
SYSCALL_INIT_HELPER(kmq_unlink),
SYSCALL_INIT_LAST
};Not sure if this is the right way to go about this, please let me know.