Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bind() on AF_UNIX socket may fail in tests run as non-root #80522

Closed
xdegaye mannequin opened this issue Mar 18, 2019 · 2 comments
Closed

bind() on AF_UNIX socket may fail in tests run as non-root #80522

xdegaye mannequin opened this issue Mar 18, 2019 · 2 comments
Labels
3.8 (EOL) end of life tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented Mar 18, 2019

BPO 36341
Nosy @xdegaye, @miss-islington
PRs
  • bpo-36341: Fix tests calling bind() on AF_UNIX sockets #12399
  • 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 2019-05-03.15:09:35.655>
    created_at = <Date 2019-03-18.09:28:31.739>
    labels = ['3.8', 'type-bug', 'tests']
    title = 'bind() on AF_UNIX socket may fail in tests run as non-root'
    updated_at = <Date 2019-05-03.15:09:35.654>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2019-05-03.15:09:35.654>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-03.15:09:35.655>
    closer = 'asvetlov'
    components = ['Tests']
    creation = <Date 2019-03-18.09:28:31.739>
    creator = 'xdegaye'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36341
    keywords = ['patch']
    message_count = 2.0
    messages = ['338183', '341342']
    nosy_count = 2.0
    nosy_names = ['xdegaye', 'miss-islington']
    pr_nums = ['12399']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36341'
    versions = ['Python 3.8']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Mar 18, 2019

    This happens on Android where a SELinux policy prevents a plain user to bind() a pathname AF_UNIX socket (abstract and unnamed sockets are not constrained by this policy).

    The errors are:

    test_asyncio:
    ======================================================================
    ERROR: test_start_unix_server_1 (test.test_asyncio.test_server.SelectorStartServerTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
    File "/data/local/tmp/python/lib/python3.8/test/test_asyncio/test_server.py", line 105, in test_start_unix_server_1
      srv = self.loop.run_until_complete(asyncio.start_unix_server(
    File "/data/local/tmp/python/lib/python3.8/asyncio/base_events.py", line 589, in run_until_complete
      return future.result()
    File "/data/local/tmp/python/lib/python3.8/asyncio/streams.py", line 115, in start_unix_server
      return await loop.create_unix_server(factory, path, **kwds)
    File "/data/local/tmp/python/lib/python3.8/asyncio/unix_events.py", line 285, in create_unix_server
      sock.bind(path)
    PermissionError: [Errno 13] Permission denied

    test_socket:
    ======================================================================
    ERROR: test_socket_fileno (test.test_socket.GeneralModuleTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
    File "/data/local/tmp/python/lib/python3.8/test/test_socket.py", line 1780, in test_socket_fileno
      s.bind(os.path.join(tmpdir, 'socket'))
    PermissionError: [Errno 13] Permission denied

    test_stat:
    ======================================================================
    ERROR: test_socket (test.test_stat.TestFilemodeCStat)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
    File "/data/local/tmp/python/lib/python3.8/test/test_stat.py", line 198, in test_socket
      s.bind(TESTFN)
    PermissionError: [Errno 13] Permission denied

    ======================================================================
    ERROR: test_socket (test.test_stat.TestFilemodePyStat)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
    File "/data/local/tmp/python/lib/python3.8/test/test_stat.py", line 198, in test_socket
      s.bind(TESTFN)
    PermissionError: [Errno 13] Permission denied

    @xdegaye xdegaye mannequin added 3.8 (EOL) end of life tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Mar 18, 2019
    @miss-islington
    Copy link
    Contributor

    New changeset 4461d70 by Miss Islington (bot) (xdegaye) in branch 'master':
    bpo-36341: Fix tests calling bind() on AF_UNIX sockets (GH-12399)
    4461d70

    @asvetlov asvetlov closed this as completed May 3, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 (EOL) end of life tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants