-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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 fails after 2038 #101732
Comments
We have plenty of time to fix this one! (joking, sorry) 😆 |
Hi @blemouzy, I'm new to cpython and curious in having a look at this. I've managed to build cpython and ssl module on an i686 virtual machine (debian 11, linux kernel 5.10). Could you clarify the following step a bit further? I'm not sure if it's just python that needs to be built with these options (in make file CFLAGS or CPPFLAGS?), or both the kernel and user space binaries (i.e everything)? At present, I'm not able to set a system date later than 2038, nor using python datetime module in my 32 bit build:
|
Hi,
Linux kernel supports 64 bits time syscalls since 5.1 (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=48166e6ea47d23984f0b481ca199250e1ce0730a) and is supposed to be fully usable since 5.6. So you have nothing to do with your current version.
You have to use a 64 bits time ready libc (glibc >= 2.35, muslc, ...). You also have to take care about your filesystem.
You can, for example, find more information here: https://sourceware.org/glibc/wiki/Y2038ProofnessDesign |
Hello again, Good news. I've managed to reproduce this issue after building 32-bit Linux From Scratch using the 64-bit time flags you mentioned:
Issues encountered with other projects:
I'll aim to inform relevant project's maintainers on the above 2x |
I believe I've found the root cause of the issue here: Lines 5004 to 5007 in a33ce66
Output of https://www.openssl.org/docs/manmaster/man3/SSL_SESSION_get_time.html The OpenSSL team are aware of this: I'll try and draft a PR against the OpenSSL project soon and test it against this issue. The cpython fix for this issue will be dependant on the OpenSSL fix. As the fix for this issue will most likely extend their API, I'll probably have to add logic for cpython to fall back to the existing and older non-Y2038 compatible OpenSSL APIs where the extended functions using more appropriate data types are not available. |
Hi Team, I've just submitted the following draft PR to openssl: Potentially a slow-burner as the existing commentary in the associated openssl issue (openssl/openssl#16726) suggests that other parts of the library may also be affected by Y2038, which will also need to be discovered and patched (or proven to not be required). I'll try and draft a better python patch soon, a rudimentary one for Yocto Kirkstone is available here: |
The openssl fix has just landed and will be released in 3.3.0: |
openssl 3.3.0 has been released. So now everything is ready to fix this in python (should be easy, use the new function subject to openssl version being at least 3.3.0). |
This sounds like an issue on systems that force 32-bit time, where the final second that can be represented in 32 bits falls on January 19, 2038 as the initial second would have been on the beginning of January 1, 1970. |
I understand that OpenSSL 3.3.0 is now available. However, many distributions of Linux have not yet packaged this new version of the software, so assuming you are on Ubuntu 22.04.1 LTS, you should expect to have OpenSSL version 3.0.2 installed on your system. |
This is not the case. The issue occurs on 32 bit systems with 64 bit time as well, and was traced to openssl incorrectly using long type for time in one of its public APIs. |
Which is fine. Any prospective fix would be conditional on the openssl version, and remain compatible with older versions as well. There's a way to check what openssl version is used at build time. |
Environment
Description
test_ssl returns the following error on 32 bits board with system date after 2038:
The same test passes with a system date before 2038.
How to reproduce
enddate
to20421028142316Z
in make_ssl_certs.py fileLinked PRs
The text was updated successfully, but these errors were encountered: