Skip to content

multiprocessing.connection.Listener fails to close with null byte in AF_UNIX socket name. #84031

Closed

Description

@nmichaels
mannequin
BPO 39850
Nosy @pitrou, @pablogsal
PRs
  • bpo-39850: Add support for abstract sockets in multiprocessing #18866
  • [3.8] bpo-39850: Add support for abstract sockets in multiprocessing (GH-18866) #18876
  • [3.7]bpo-39850: Add support for abstract sockets in multiprocessing (GH-18866) #18877
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-03-09.14:48:23.277>
    created_at = <Date 2020-03-04.16:12:51.698>
    labels = ['3.7', '3.8', 'type-bug', 'library', '3.9']
    title = 'multiprocessing.connection.Listener fails to close with null byte in AF_UNIX socket name.'
    updated_at = <Date 2020-03-09.14:48:23.277>
    user = 'https://bugs.python.org/nmichaels'

    bugs.python.org fields:

    activity = <Date 2020-03-09.14:48:23.277>
    actor = 'pablogsal'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-03-09.14:48:23.277>
    closer = 'pablogsal'
    components = ['Library (Lib)']
    creation = <Date 2020-03-04.16:12:51.698>
    creator = 'nmichaels'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39850
    keywords = ['patch']
    message_count = 4.0
    messages = ['363357', '363730', '363737', '363738']
    nosy_count = 3.0
    nosy_names = ['pitrou', 'nmichaels', 'pablogsal']
    pr_nums = ['18866', '18876', '18877']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue39850'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    Activity

    1. added
      type-crashA hard crash of the interpreter, possibly with a core dump
      stdlibStandard Library Python modules in the Lib/ directory
      on Mar 4, 2020
    2. nmichaels commented on Mar 4, 2020

      nmichaelsmannequin
      MannequinAuthor
      >>> from multiprocessing.connection import Listener
      >>> listener = Listener('\0conntest', family='AF_UNIX')
      >>> listener.close()
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/usr/lib64/python3.6/multiprocessing/connection.py", line 466, in close
          listener.close()
        File "/usr/lib64/python3.6/multiprocessing/connection.py", line 604, in close
          unlink()
        File "/usr/lib64/python3.6/multiprocessing/util.py", line 186, in __call__
          res = self._callback(*self._args, **self._kwargs)
      ValueError: embedded null byte

      Linux has a handy feature where if the first byte of a unix domain socket's name is the null character, it won't put it in the filesystem. The socket interface works fine with it, but when SocketListener is wrapped around a socket, it throws this exception.

    3. added
      type-bugAn unexpected behavior, bug, or error
      and removed
      type-crashA hard crash of the interpreter, possibly with a core dump
      on Mar 8, 2020
    4. pablogsal commented on Mar 9, 2020

      @pablogsal
      Member

      New changeset 6012f30 by Pablo Galindo in branch 'master':
      bpo-39850: Add support for abstract sockets in multiprocessing (GH-18866)
      6012f30

    5. pablogsal commented on Mar 9, 2020

      @pablogsal
      Member

      New changeset 2235e04 by Pablo Galindo in branch '3.7':
      [3.7] bpo-39850: Add support for abstract sockets in multiprocessing (GH-18866) (GH-18877)
      2235e04

    6. pablogsal commented on Mar 9, 2020

      @pablogsal
      Member

      New changeset 3ede1bc by Pablo Galindo in branch '3.8':
      [3.8] bpo-39850: Add support for abstract sockets in multiprocessing (GH-18866) (GH-18876)
      3ede1bc

    7. transferred this issue fromon Apr 10, 2022
    8. gpshead commented on Oct 20, 2022

      @gpshead
      Member

      Now that it's public... if you are explicitly asking multiprocessing to use Linux abstract sockets in your code you likely have a security problem: #97514

    9. added a commit that references this issue on Oct 20, 2022
    10. added 6 commits that reference this issue on Oct 20, 2022
    11. added a commit that references this issue on Oct 22, 2022
    12. added a commit that references this issue on Oct 28, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)end of life3.8 (EOL)end of life3.9 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions