Bug 2263877

Summary: new version of openssl breaks curl test suite - it blocks curl builds
Product: [Fedora] Fedora Reporter: Jan Macku <jamacku>
Component: opensslAssignee: Dmitry Belyavskiy <dbelyavs>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: rawhideCC: crypto-team, dbelyavs, kdudka, mspacek, mturk, shebburn, tm
Target Milestone: ---Keywords: Triaged
Target Release: ---Flags: fedora-admin-xmlrpc: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: openssl-3.2.1-3.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-04-03 07:22:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Macku 2024-02-12 14:30:00 UTC
Curl can't be built with new openssl 3.2.1 in Fedora Rawhide

Please see the following logs for more details.

```
test 0313...[CRL test]
../libtool --mode=execute /usr/bin/valgrind --tool=memcheck --quiet --leak-check=yes --suppressions=../../tests/valgrind.supp --num-callers=16 --log-file=log/valgrind313 ../src/curl --output log/curl313.out  --include --trace-ascii log/trace313 --trace-time --cacert ../../tests/certs/EdelCurlRoot-ca.crt --crlfile ../../tests/certs/Server-localhost-sv.crl https://localhost:37247/313 > log/stdout313 2> log/stderr313
CMD (15360): ../libtool --mode=execute /usr/bin/valgrind --tool=memcheck --quiet --leak-check=yes --suppressions=../../tests/valgrind.supp --num-callers=16 --log-file=log/valgrind313 ../src/curl --output log/curl313.out  --include --trace-ascii log/trace313 --trace-time --cacert ../../tests/certs/EdelCurlRoot-ca.crt --crlfile ../../tests/certs/Server-localhost-sv.crl https://localhost:37247/313 > log/stdout313 2> log/stderr313
 valgrind ERROR ==89628== 1,795 (248 direct, 1,547 indirect) bytes in 1 blocks are definitely lost in loss record 32 of 32
==89628==    at 0x484280F: malloc (vg_replace_malloc.c:442)
==89628==    by 0x4D71B20: CRYPTO_malloc (in /usr/lib64/libcrypto.so.3.2.1)
==89628==    by 0x4D71BD4: CRYPTO_zalloc (in /usr/lib64/libcrypto.so.3.2.1)
==89628==    by 0x4C67FD3: ??? (in /usr/lib64/libcrypto.so.3.2.1)
==89628==    by 0x4C69B00: ??? (in /usr/lib64/libcrypto.so.3.2.1)
==89628==    by 0x4C69E3F: ASN1_item_d2i_ex (in /usr/lib64/libcrypto.so.3.2.1)
==89628==    by 0x4D944C0: PEM_ASN1_read_bio (in /usr/lib64/libcrypto.so.3.2.1)
==89628==    by 0x4DD3C31: X509_load_crl_file (in /usr/lib64/libcrypto.so.3.2.1)
==89628==    by 0x48B6D48: UnknownInlinedFun (openssl.c:3284)
==89628==    by 0x48B6D48: Curl_ssl_setup_x509_store (openssl.c:3437)
==89628==    by 0x48B7445: ossl_bio_cf_in_read (openssl.c:776)
==89628==    by 0x4C6DB32: ??? (in /usr/lib64/libcrypto.so.3.2.1)
==89628==    by 0x4C71C16: ??? (in /usr/lib64/libcrypto.so.3.2.1)
==89628==    by 0x4C71DAA: BIO_read (in /usr/lib64/libcrypto.so.3.2.1)
==89628==    by 0x4B9BE92: ??? (in /usr/lib64/libssl.so.3.2.1)
==89628==    by 0x4BA0B4A: ??? (in /usr/lib64/libssl.so.3.2.1)
==89628==    by 0x4B9B099: ??? (in /usr/lib64/libssl.so.3.2.1)
==89628== 
== Contents of files in the log/ dir after test 313
=== Start of file commands.log
 ../libtool --mode=execute /usr/bin/valgrind --tool=memcheck --quiet --leak-check=yes --suppressions=../../tests/valgrind.supp --num-callers=16 --log-file=log/valgrind313 ../src/curl --output log/curl313.out  --include --trace-ascii log/trace313 --trace-time --cacert ../../tests/certs/EdelCurlRoot-ca.crt --crlfile ../../tests/certs/Server-localhost-sv.crl https://localhost:37247/313 > log/stdout313 2> log/stderr313
=== End of file commands.log
```

Reproducible: Always

Steps to Reproduce:
Try to build a curl package, test 0313 will fail (valgrind detects a leak)

Related upstream references:
- https://github.com/curl/curl/pull/11531

Comment 1 Dmitry Belyavskiy 2024-02-26 14:21:29 UTC
More detailed log after installing debug libraries

==============
startnew: perl -I../../tests ../../tests/http-server.pl --keepalive 30 --pidfile "log/server/http_server.pid" --logfile "log/http_server.log" --logdir "log" --portfile log/server/http_server.port --config log/server.cmd --ipv4 --port 0 --srcdir "../../tests"
RUN: ../src/curl --max-time 13 --output log/http_verify.out --silent --verbose --globoff "http://127.0.0.1:46535/verifiedserver" 2>log/http_verify.log
CMD (0): ../src/curl --max-time 13 --output log/http_verify.out --silent --verbose --globoff "http://127.0.0.1:46535/verifiedserver" 2>log/http_verify.log
RUN: HTTP server is on PID 309382 port 46535
* pid http => 309382 309382
startnew: perl -I../../tests ../../tests/secureserver.pl --pidfile "log/server/https_server.pid" --logfile "log/https_stunnel.log" --logdir "log" --ipv4 --proto https --certfile "Server-localhost-sv.pem" --stunnel "/usr/bin/stunnel" --srcdir "../../tests" --connect 46535 --accept 33985
RUN: HTTPS server is PID 309398 port 33985
* pid https => 309398 309403
prechecked /usr/bin/perl -e "print 'Test requires default test server host' if ( '127.0.0.1' ne '127.0.0.1' );"
test 0313...[CRL test]
../libtool --mode=execute /usr/bin/valgrind --tool=memcheck --quiet --leak-check=yes --suppressions=../../tests/valgrind.supp --num-callers=16 --log-file=log/valgrind313 ../src/curl --output log/curl313.out  --include --trace-ascii log/trace313 --trace-time --cacert ../../tests/certs/EdelCurlRoot-ca.crt --crlfile ../../tests/certs/Server-localhost-sv.crl https://localhost:33985/313 > log/stdout313 2> log/stderr313
CMD (15360): ../libtool --mode=execute /usr/bin/valgrind --tool=memcheck --quiet --leak-check=yes --suppressions=../../tests/valgrind.supp --num-callers=16 --log-file=log/valgrind313 ../src/curl --output log/curl313.out  --include --trace-ascii log/trace313 --trace-time --cacert ../../tests/certs/EdelCurlRoot-ca.crt --crlfile ../../tests/certs/Server-localhost-sv.crl https://localhost:33985/313 > log/stdout313 2> log/stderr313
 valgrind ERROR ==309410== 1,795 (248 direct, 1,547 indirect) bytes in 1 blocks are definitely lost in loss record 32 of 32
==309410==    at 0x484280F: malloc (vg_replace_malloc.c:442)
==309410==    by 0x4D77B20: CRYPTO_malloc (mem.c:202)
==309410==    by 0x4D77BD4: CRYPTO_zalloc (mem.c:222)
==309410==    by 0x4C6DFD3: asn1_item_embed_new (tasn_new.c:136)
==309410==    by 0x4C6FB00: UnknownInlinedFun (tasn_new.c:52)
==309410==    by 0x4C6FB00: asn1_item_embed_d2i (tasn_dec.c:366)
==309410==    by 0x4C6FE3F: UnknownInlinedFun (tasn_dec.c:118)
==309410==    by 0x4C6FE3F: ASN1_item_d2i_ex (tasn_dec.c:144)
==309410==    by 0x4D9A4C0: PEM_ASN1_read_bio (pem_oth.c:31)
==309410==    by 0x4DD9C31: X509_load_crl_file (by_file.c:180)
==309410==    by 0x48B6D48: UnknownInlinedFun (openssl.c:3284)
==309410==    by 0x48B6D48: Curl_ssl_setup_x509_store (openssl.c:3437)
==309410==    by 0x48B7445: ossl_bio_cf_in_read (openssl.c:776)
==309410==    by 0x4C73B32: bread_conv (bio_meth.c:121)
==309410==    by 0x4C77C16: bio_read_intern (bio_lib.c:285)
==309410==    by 0x4C77DAA: UnknownInlinedFun (bio_lib.c:311)
==309410==    by 0x4C77DAA: BIO_read (bio_lib.c:303)
==309410==    by 0x4BA1E92: tls_default_read_n (tls_common.c:398)
==309410==    by 0x4BA6B4A: tls_get_more_records (tls_common.c:575)
==309410==    by 0x4BA1099: tls_read_record (tls_common.c:1122)
==309410== 
=======================

Comment 2 Dmitry Belyavskiy 2024-02-27 11:58:02 UTC
Upstream:

./configure --with-openssl && make && make test TFLAGS="313"

Comment 3 Jan Macku 2024-02-27 12:15:31 UTC
From curl spec:

./configure --cache-file=../config.cache --disable-manual --disable-static --enable-hsts --enable-ipv6 --enable-symbol-hiding --enable-threaded-resolver --without-zstd --with-gssapi --with-libidn2 --with-nghttp2 --with-ssl --with-ca-bundle=/etc/pki/tls/certs/ca-bundle.crt --enable-dict --enable-gopher --enable-imap --enable-ldap --enable-ldaps --enable-mqtt --enable-ntlm --enable-ntlm-wb --enable-pop3 --enable-rtsp --enable-smb --enable-smtp --enable-telnet --enable-tftp --enable-tls-srp --enable-websockets --with-brotli --with-libpsl --with-libssh && make && make test TFLAGS="313"

Comment 4 Jan Macku 2024-04-03 07:22:04 UTC
I have verified that this issue is fixed with the latest version - openssl-3.2.1-3.fc41.

Thank you for the fix.