8000 gh-127257: ssl: Raise OSError for ERR_LIB_SYS by encukou · Pull Request #127361 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-127257: ssl: Raise OSError for ERR_LIB_SYS #127361

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

Merged
merged 2 commits into from
Dec 10, 2024
Merged

Conversation

encukou
Copy link
Member
@encukou encukou commented Nov 28, 2024

One way OpenSSL can report a failed syscall is SSL_ERROR_SYSCALL. We have that one covered.

But, another way is ERR_LIB_SYS. Apparently, it's being used more now, and causing issues on OpenSSL 3.4.0 on Arch buildbots.

From the ERR_raise manpage:

ERR_LIB_SYS

    This "library code" indicates that a system error is
    being reported.  In this case, the reason code given
    to `ERR_raise()` and `ERR_raise_data()` *must* be
    `errno(3)`.

This PR only handles ERR_LIB_SYS for the high-lever error types
SSL_ERROR_SYSCALL and SSL_ERROR_SSL, i.e., not the ones where
OpenSSL indicates it has some more information about the issue.

I believe it's correct to raise OSError rather that SSLError
in these cases. That makes this a backwards-incompatible change
(but one we still might want to backport as a bugfix).

The error on Arch with OpenSSL 3.4.0 is broken pipe (EPIPE) when a client reads after the server shuts down. On my Arch, raising OSError makes test_poplip pass.

From the ERR_raise manpage:

    ERR_LIB_SYS

        This "library code" indicates that a system error is
        being reported.  In this case, the reason code given
        to `ERR_raise()` and `ERR_raise_data()` *must* be
        `errno(3)`.
@encukou
Copy link
Member Author
encukou commented Nov 28, 2024

!buildbot Arch.Linux

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @encukou for commit 0098897 🤖

The command will test the builders whose names match following regular expression: Arch.Linux

The builders matched are:

  • AMD64 Arch Linux Perf PR
  • AMD64 Arch Linux Asan PR
  • AMD64 Arch Linux VintageParser PR
  • AMD64 Arch Linux Valgrind PR
  • AMD64 Arch Linux Usan PR
  • AMD64 Arch Linux Usan Function PR
  • AMD64 Arch Linux Asan Debug PR
  • AMD64 Arch Linux TraceRefs PR

@petermarko
Copy link
Contributor

This fixes #125936 for me.
Thanks!

halstead pushed a commit to yoctoproject/poky that referenced this pull request Nov 29, 2024
python/cpython#127331
python/cpython#127361

(From OE-Core rev: e271e9cbf896f1fb97d56c426e4217a6d2105ea4)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Nov 29, 2024
python/cpython#127331
python/cpython#127361

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Nov 29, 2024
python/cpython#127331
python/cpython#127361

(From OE-Core rev: e5f3a1793e34fb4cd1e53ca60b67f9a9f084b7a6)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Nov 29, 2024
python/cpython#127331
python/cpython#127361

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
daregit pushed a commit to daregit/yocto-combined that referenced this pull request Nov 29, 2024
python/cpython#127331
python/cpython#127361

(From OE-Core rev: e5f3a1793e34fb4cd1e53ca60b67f9a9f084b7a6)

Signed-off-by: Peter Marko <peter.markosiemens.com>
Signed-off-by: Richard Purdie <richard.purdielinuxfoundation.org>
daregit pushed a commit to daregit/yocto-combined that referenced this pull request Dec 1, 2024
python/cpython#127331
python/cpython#127361

(From OE-Core rev: e5f3a1793e34fb4cd1e53ca60b67f9a9f084b7a6)

Signed-off-by: Peter Marko <peter.markosiemens.com>
Signed-off-by: Richard Purdie <richard.purdielinuxfoundation.org>
@encukou
Copy link
Member Author
encukou commented Dec 4, 2024

ssl experts (@jackjansen, @tiran, @dstufft, @alex): Do you want to check the change?
I think this is the correct place, and the correct error to raise, but I'd appreciate someone with domain knowledge.

@encukou
Copy link
Member Author
encukou commented Dec 9, 2024

If there are no objections, I'll merge tomorrow to unblock the buildbots.

Copy link
Member
@vstinner vstinner left a comment