Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2107689

Summary: Autobind of empty unix socket on Linux broken since python 3.9
Product: Red Hat Enterprise Linux 9 Reporter: Nir Soffer <nsoffer>
Component: python3.9Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED CURRENTRELEASE QA Contact: Lukáš Zachar <lzachar>
Severity: medium Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, cstratak, jwboyer, pgm-rhel-tools, pviktori, torsava, vstinner
Target Milestone: rcKeywords: Rebase, Regression, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python3.9-3.9.14-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2128249 (view as bug list) Environment:
Last Closed: 2023-08-07 08:57:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nir Soffer 2022-07-15 16:16:55 UTC
Description of problem:

Since python 3.9, bind("") binds to b"\x00" instead of to a random address
in the abstract namespace (e.g. b"\x0012345")

In python 3.8:

    $ python3.8
    Python 3.8.13 (default, Jun 10 2022, 00:00:00) 
    [GCC 12.1.1 20220507 (Red Hat 12.1.1-1)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import socket
    >>> s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    >>> s.bind("")
    >>> s.getsockname()
    b'\x0075499'

With python 3.9:

    $ python3
    Python 3.9.13 (main, Jun  9 2022, 00:00:00) 
    [GCC 11.3.1 20220421 (Red Hat 11.3.1-2)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import socket
    >>> s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    >>> s.bind("")
    >>> s.getsockname()
    b'\x00'

Trying to bind multiple socket to "" will fail with:

    OSError: [Errno 98] Address already in use


Version-Release number of selected component (if applicable):
python3-3.9.13-2.el9.x86_64

How reproducible:
100%

Upstream bug:
https://github.com/python/cpython/issues/94821

Fixed in:
https://github.com/python/cpython/pull/94826

Backport to 3.9:
https://github.com/python/cpython/pull/94875

Comment 3 Tomas Orsava 2022-08-10 12:07:53 UTC
This has been fixed in Python 3.9 on July 26th 2022, since it's not urgent we're waiting for a new release of Python 3.9 upstream (happens every ~2 months) and then we'll rebase. Most likely this will happen for RHEL 9.2.

Comment 4 Victor Stinner 2022-09-12 12:24:07 UTC
Python 3.9.14 released last week contains the fix: https://pythoninsider.blogspot.com/2022/09/python-releases-3107-3914-3814-and-3714.html

Comment 8 Charalampos Stratakis 2022-09-23 16:00:13 UTC
*** Bug 2129075 has been marked as a duplicate of this bug. ***