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

test_ssl.py hangs with SSL 1.1 built with no threads #84695

Closed
mig28suarez mannequin opened this issue May 5, 2020 · 8 comments
Closed

test_ssl.py hangs with SSL 1.1 built with no threads #84695

mig28suarez mannequin opened this issue May 5, 2020 · 8 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes topic-SSL type-bug An unexpected behavior, bug, or error

Comments

@mig28suarez
Copy link
Mannequin

mig28suarez mannequin commented May 5, 2020

BPO 40515
Nosy @tiran, @miss-islington
PRs
  • bpo-40515: Require OPENSSL_THREADS #19953
  • [3.8] bpo-40515: Require OPENSSL_THREADS (GH-19953) (GH-20119) #20119
  • [3.7] bpo-40515: Require OPENSSL_THREADS (GH-19953) (GH-20120) #20120
  • 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 = 'https://github.com/tiran'
    closed_at = <Date 2020-05-15.20:38:47.249>
    created_at = <Date 2020-05-05.13:20:24.760>
    labels = ['expert-SSL', '3.8', 'type-bug', '3.7', '3.9']
    title = 'test_ssl.py hangs with SSL 1.1 built with no threads'
    updated_at = <Date 2020-05-15.20:38:47.248>
    user = 'https://bugs.python.org/mig28suarez'

    bugs.python.org fields:

    activity = <Date 2020-05-15.20:38:47.248>
    actor = 'christian.heimes'
    assignee = 'christian.heimes'
    closed = True
    closed_date = <Date 2020-05-15.20:38:47.249>
    closer = 'christian.heimes'
    components = ['SSL']
    creation = <Date 2020-05-05.13:20:24.760>
    creator = 'mig28suarez'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40515
    keywords = ['patch']
    message_count = 8.0
    messages = ['368143', '368145', '368155', '368176', '368964', '368969', '368970', '368971']
    nosy_count = 3.0
    nosy_names = ['christian.heimes', 'miss-islington', 'mig28suarez']
    pr_nums = ['19953', '20119', '20120']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue40515'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @mig28suarez
    Copy link
    Mannequin Author

    mig28suarez mannequin commented May 5, 2020

    Hello, this is my first python bug report!

    I've been running builds of Python 3.7.x on CentOS Linux release 7.7 (64bit/Intel Core
    2 Duo)
    and I ran into hangs with test_ssl.py when using latest SSL 1.1.1d sources.

    I've done a full compilation from source for Python 3.7.7 and SSL 1.1 in my
    workspaces.

    From what I can tell the problem is when SSL 1.1 is built with no threading
    there is no locking enabled by python.

    This one line change will make the hangs in test_ssl.py go away:

    Index: Modules/_ssl.c

    --- Modules/_ssl.c      (revision 70)
    +++ Modules/_ssl.c      (working copy)
    @@ -5875,7 +5875,7 @@
         if (!_setup_ssl_threads()) {
             return NULL;
         }
    -#elif OPENSSL_VERSION_1_1 && defined(OPENSSL_THREADS)
    +#elif OPENSSL_VERSION_1_1
         / OpenSSL 1.1.0 builtin thread support is enabled /
         _ssl_locks_count++;

    # endif

    There appears to be an assumption in _ssl.c and test_ssl.y that SSL 1.1 will be
    threaded
    but this may not be true (as in my case).

    Appreciate any feedback. Thanks!

    @mig28suarez mig28suarez mannequin added 3.8 only security fixes 3.9 only security fixes 3.7 (EOL) end of life labels May 5, 2020
    @mig28suarez mig28suarez mannequin assigned tiran May 5, 2020
    @mig28suarez mig28suarez mannequin added topic-SSL 3.8 only security fixes type-bug An unexpected behavior, bug, or error labels May 5, 2020
    @tiran
    Copy link
    Member

    tiran commented May 5, 2020

    How did you build OpenSSL 1.1.1d? Python assumes default build of OpenSSL. Since Python is now always multi-threaded we no longer support non-threaded OpenSSL builds.

    @tiran tiran removed 3.8 only security fixes 3.9 only security fixes labels May 5, 2020
    @mig28suarez
    Copy link
    Mannequin Author

    mig28suarez mannequin commented May 5, 2020

    I built with 'no-threads' option.
    I understand if you no longer wish to support non-threaded SSL.
    But it just seemed to me that you could if you protected the SSL API calls with locking since I can get all your ssl tests to work with this minor change.

    @tiran
    Copy link
    Member

    tiran commented May 5, 2020

    It not about what I wish or wish not to do.

    Python requires thread-safe libraries. A library without proper locking and thread safety is no longer safe to use without great effort and careful locking in the glue code. A non-threaded OpenSSL build will lead to memory corruption and eventually crash the interpreter.

    @miss-islington
    Copy link
    Contributor

    New changeset c087a26 by Christian Heimes in branch 'master':
    bpo-40515: Require OPENSSL_THREADS (GH-19953)
    c087a26

    @tiran
    Copy link
    Member

    tiran commented May 15, 2020

    New changeset 387c744 by Christian Heimes in branch '3.8':
    [3.8] bpo-40515: Require OPENSSL_THREADS (GH-19953) (GH-20119)
    387c744

    @tiran
    Copy link
    Member

    tiran commented May 15, 2020

    New changeset efc9065 by Christian Heimes in branch '3.7':
    [3.7] bpo-40515: Require OPENSSL_THREADS (GH-19953) (GH-20120)
    efc9065

    @tiran
    Copy link
    Member

    tiran commented May 15, 2020

    Users will now get an error message when they are trying to compile against an OpenSSL build without thread support.

    @tiran tiran added 3.8 only security fixes 3.9 only security fixes labels May 15, 2020
    @tiran tiran closed this as completed May 15, 2020
    @tiran tiran added 3.8 only security fixes 3.9 only security fixes labels May 15, 2020
    @tiran tiran closed this as completed May 15, 2020
    @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.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes topic-SSL type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants