The sendMsg implementation is likely not GC-safe. It uses pointer values outside withForeignPtr. The underlying ByteStrings that own the pointers may be deallocated before the pointers are used.
I think it is necessary to retain and touch# all the foreign pointers of each ByteString. Similar issues may be present in some of the other new functions.