You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As identified in #114887 , asyncio's support for SocketCAN regressed for a long time when datagram endpoint creation was limited specifically to SOCK_DGRAM, thus incorrectly excluding SOCK_RAW.
The other untested-but-not-deprecated-at-the-OS-level socket types (SOCK_RDM, SOCK_SEQPACKET) aren't part of any standard internet protocol, but SOCK_RAW is actively used for hardware CAN bus access, so it seems reasonable to figure out a way to cover it in the regression test suite.
The part that makes this tricky is that raw sockets are also used to craft malicious attack packets in malware, so modern operating systems restrict access to them by default. Simply attempting to create a couple of SOCK_RAW endpoints in the test suite and run some of the existing SOCK_DGRAM tests over them would routinely fail with OS permission errors.
I don't have a clear solution in mind for that problem, but the ideas I've had so far are:
define a new test resource for netraw (named after CAP_NET_RAW in Linux), gate SOCK_RAW tests for socket and asyncio behind that
combine the two, with the latter used as a fallback testing option when the netraw resource isn't available
I don't know a clean cross-platform way to test for raw socket permissions that doesn't risk getting the test suite flagged as potential malware by behaviour monitoring systems, so the test resource seems like the best bet as a way of determining whether or not to even try creating any raw sockets.
Whether to try to test SOCK_RAW on GitHub actions and the buildbot fleet would be separate questions, but they'd need to be running in at least some locations to be useful.
As identified in #114887 , asyncio's support for SocketCAN regressed for a long time when datagram endpoint creation was limited specifically to
SOCK_DGRAM, thus incorrectly excludingSOCK_RAW.The other untested-but-not-deprecated-at-the-OS-level socket types (
SOCK_RDM,SOCK_SEQPACKET) aren't part of any standard internet protocol, butSOCK_RAWis actively used for hardware CAN bus access, so it seems reasonable to figure out a way to cover it in the regression test suite.The part that makes this tricky is that raw sockets are also used to craft malicious attack packets in malware, so modern operating systems restrict access to them by default. Simply attempting to create a couple of
SOCK_RAWendpoints in the test suite and run some of the existingSOCK_DGRAMtests over them would routinely fail with OS permission errors.I don't have a clear solution in mind for that problem, but the ideas I've had so far are:
netraw(named afterCAP_NET_RAWin Linux), gateSOCK_RAWtests forsocketandasynciobehind thatsocketsubclass that isSOCK_DGRAMunder the hood (so no elevated permissions needed), but claimsSOCK_RAWas its socket type (so it would still flush out incorrect asyncio level assumptions like create_datagram_endpoint() no longer compatible with CAN bus raw sockets #114887 )netrawresource isn't availableI don't know a clean cross-platform way to test for raw socket permissions that doesn't risk getting the test suite flagged as potential malware by behaviour monitoring systems, so the test resource seems like the best bet as a way of determining whether or not to even try creating any raw sockets.
Whether to try to test
SOCK_RAWon GitHub actions and the buildbot fleet would be separate questions, but they'd need to be running in at least some locations to be useful.Linked PRs