Source: m2crypto
Severity: important
Tags: patch
X-Debbugs-Cc: [email protected]
User: [email protected]

When running the test suite on 32-bit architectures that use 64-bit time_t 
(e.g., modern armhf/i386 for Y2038 compliance), test_server_simple_timeouts 
fails with OSError: [Errno 22] Invalid argument.

Steps to Reproduce

Run autopkgtest or pytest on a 32-bit system with a 64-bit time_t kernel. Run 
tests/test_ssl.py::MiscSSLClientTestCase::test_server_simple_timeouts.

Actual Result (logs -> 
https://objectstorage.prodstack5.canonical.com/swift/v1/AUTH_0f9aae918d5b4744bf7b827671c86842/autopkgtest-resolute/resolute/armhf/m/m2crypto/20260113_215730_4a505@/log.gz)

E       OSError: [Errno 22] Invalid argument
/usr/lib/python3/dist-packages/M2Crypto/SSL/Connection.py:689: OSError
The M2Crypto.SSL.timeout.timeout.pack() method uses struct.pack("ll", ...) when 
m2.time_t_bits() == 64.

On standard 64-bit systems (x86_64), l is 8 bytes. ll = 16 bytes. (Correct)

On 32-bit systems, l is 4 bytes. ll = 8 bytes. (Incorrect)

The kernel expects a 16-byte struct timeval (two 64-bit integers) because of 
the Y2038-compliant 64-bit time_t. Passing an 8-byte structure causes 
setsockopt to reject the call with EINVAL.

Proposed Fix: Change the packing format from "ll" to "qq" (long long). This 
forces 8-byte integers on all platforms, ensuring the structure is always 16 
bytes when time_t is 64-bit.



-- System Information:
Debian Release: forky/sid
  APT prefers questing-updates
  APT policy: (500, 'questing-updates'), (500, 'questing-security'), (500, 
'questing'), (100, 'questing-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 6.17.0-8-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Reply via email to