summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2022-10-20 22:30:09 (GMT)
committerGitHub <noreply@github.com>2022-10-20 22:30:09 (GMT)
commit49f61068f49747164988ffc5a442d2a63874fc17 (patch)
tree48001da7207b0a087954e2007d544d2adcbb470a /Lib/multiprocessing
parent39bc70e267929600057d62103739b7160e69dc8b (diff)
downloadcpython-49f61068f49747164988ffc5a442d2a63874fc17.zip
cpython-49f61068f49747164988ffc5a442d2a63874fc17.tar.gz
cpython-49f61068f49747164988ffc5a442d2a63874fc17.tar.bz2
gh-97514: Don't use Linux abstract sockets for multiprocessing (#98501)
Linux abstract sockets are insecure as they lack any form of filesystem permissions so their use allows anyone on the system to inject code into the process. This removes the default preference for abstract sockets in multiprocessing introduced in Python 3.9+ via https://github.com/python/cpython/pull/18866 while fixing https://github.com/python/cpython/issues/84031. Explicit use of an abstract socket by a user now generates a RuntimeWarning. If we choose to keep this warning, it should be backported to the 3.7 and 3.8 branches.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/connection.py5
1 files changed, 0 insertions, 5 deletions
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py
index 65303d2..b08144f 100644
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -73,11 +73,6 @@ def arbitrary_address(family):
if family == 'AF_INET':
return ('localhost', 0)
elif family == 'AF_UNIX':
- # Prefer abstract sockets if possible to avoid problems with the address
- # size. When coding portable applications, some implementations have
- # sun_path as short as 92 bytes in the sockaddr_un struct.
- if util.abstract_sockets_supported:
- return f"\0listener-{os.getpid()}-{next(_mmap_counter)}"
return tempfile.mktemp(prefix='listener-', dir=util.get_temp_dir())
elif family == 'AF_PIPE':
return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' %