On 4/15/15 5:37 AM, Otto Moerbeek wrote: > On Wed, Apr 15, 2015 at 11:32:11AM +0200, Mark Kettenis wrote: > >>> Date: Tue, 14 Apr 2015 21:26:25 -0400 >>> From: William Orr <w...@worrbase.com> >>> >>> Hey, >>> >>> I was debugging a few CPython test failures yesterday, and I noticed >>> that attaching multiple cmsg structures causes unp_internalize to return >>> EINVAL. >>> >>> I've looked in unix(4) and sendmsg(2), and this caveat isn't documented >>> anywhere. >>> >>> I looked at other OSes, and Linux supports this, FreeBSD fails in >>> interesting ways and OS X returns E2BIG. >>> >>> Is this behavior intentional, and the documentation is missing this >>> failure mode? Or is the behavior unintentional? I'm happy to submit a >>> patch for either, I just want to know which behavior is intended. >> >> The behaviour is intentional. The additional complexity of supporting >> multiple cmsghdrs has caused many bugs (and associated security >> issues) in the past. The alignment fuckups in various OSes make it >> hard to use this functionality in a portable way anyway. And we only >> support SCM_RIGHTS, so there is no real reason to use multiple >> cmsghdrs in your code. > > Plus it *is* possible to send multiple fd's in one message. > > -Otto >
Yeah, I was wondering why this was allowed on some OSes in the first place, since it seems redundant. Once I'm not in an airport, I'll submit a docs patch just so that it's clear. re: CPython's test suite, I have a patch in the queue that only enables this behavior on Linux. Thanks, William Orr
signature.asc
Description: OpenPGP digital signature