Re: [Bug 273506] main [so: 15] aarch64 kyua python use fails with: . . . and dlerror is reporting "/usr/lib/ossl-modules/legacy.so: Undefined symbol \"MD4_Update\"", '\000' <repeats 449 times> [crude patch]

Mark Millard <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm,gmane.os.freebsd.current
Message-ID <[email protected]>
On Sep 2, 2023, at 09:37, Mark Millard <[email protected]> wrote:

> On Sep 2, 2023, at 00:35, Mark Millard <[email protected]> wrote:
> 
>> For:
>> 
>>> Date: Sat, 02 Sep 2023 00:58:29 UTC 
>>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273506
>>> 
>>> Bug ID: 273506
>>> Summary: main [so: 15] aarch64 kyua python use fails with:
>>> "RuntimeError: OpenSSL 3.0's legacy provider failed to
>>> load"
>>> Product: Base System
>>> Version: CURRENT
>>> Hardware: Any
>>> OS: Any
>>> Status: New
>>> Severity: Affects Only Me
>>> Priority: ---
>>> Component: arm
>>> Assignee: [email protected]
>>> Reporter: [email protected]
>> 
>> Turns out that internally dlerror is reporting:
>> 
>> "/usr/lib/ossl-modules/legacy.so: Undefined symbol \"MD4_Update\"", '\000' <repeats 449 times>
>> 
>> (as shown via a gdb session printing the string).
>> 
>> See:
>> 
>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273506#c3
>> 
>> where I finally got to that information.
> 
> amd64 did not have:
> 
> devel/py-pytest-twisted
> devel/py-twisted
> net/py-dpkt
> security/nist-kat
> security/openvpn
> 
> installed and so was not doing the same sequence of dlopen
> calls.
> 
> After adding those, the amd64 run fails like aarch64: It then starts to try
> to use .../cryptography/hazmat/bindings/_rust.abi3.so leads to the problem.
> 
> [Detaching after fork from child process 98729]
> 
> Breakpoint 1.1, dlopen (name=name@entry=0x803239710 "libc.so.7", mode=2) at /usr/main-src/libexec/rtld-elf/rtld.c:3662
> 3662 return (rtld_dlopen(name, -1, mode));
> (gdb) c
> Continuing.
> 
> Breakpoint 1.1, dlopen (name=name@entry=0x8032c80d0 "/usr/local/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so", mode=2) at /usr/main-src/libexec/rtld-elf/rtld.c:3662
> 3662 return (rtld_dlopen(name, -1, mode));
> (gdb) c
> Continuing.
> 
> Breakpoint 1.1, dlopen (name=name@entry=0x8032c7440 "/usr/local/lib/python3.9/site-packages/_cffi_backend.cpython-39.so", mode=2) at /usr/main-src/libexec/rtld-elf/rtld.c:3662
> 3662 return (rtld_dlopen(name, -1, mode));
> (gdb) c
> Continuing.
> 
> Breakpoint 1.1, dlopen (name=name@entry=0x80219d080 "/usr/lib/ossl-modules/legacy.so", mode=2) at /usr/main-src/libexec/rtld-elf/rtld.c:3662
> 3662 return (rtld_dlopen(name, -1, mode));
> (gdb) c
> Continuing.
> INTERNALERROR> Traceback (most recent call last):
> . . .
> 
> This appears to be tied to devel/py-twisted and/or devel/py-pytest-twisted
> but like anything leading to loading
> .../cryptography/hazmat/bindings/_rust.abi3.so is going to get the
> problem.
> 

The following crude patch leads to kyua's python use working
for examples/test_examples.py with devel/py-pytest-twisted and
devel/py-twisted and the like installed. The below might not
end up with leading whitespace preserved:

# git -C /usr/main-src/ diff crypto/openssl/crypto/init.c
diff --git a/crypto/openssl/crypto/init.c b/crypto/openssl/crypto/init.c
index cacf637c89f8..77f693fcfa05 100644
--- a/crypto/openssl/crypto/init.c
+++ b/crypto/openssl/crypto/init.c
@@ -159,7 +159,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_nodelete)
         if (!err_shelve_state(&err))
             return 0;
 
-        dso = DSO_dsobyaddr(&base_inited, DSO_FLAG_NO_UNLOAD_ON_FREE);
+        dso = DSO_dsobyaddr(&base_inited, DSO_FLAG_NO_UNLOAD_ON_FREE|DSO_FLAG_GLOBAL_SYMBOLS);
         /*
          * In case of No!, it is uncertain our exit()-handlers can still be
          * called. After dlclose() the whole library might have been unloaded

(A variant of the above note is also in my separate bugzilla.)

For reference:

# /usr/bin/kyua test -k /usr/tests/Kyuafile examples/test_examples.py
examples/test_examples.py:TestExampleSimple::test_get_properties -> skipped: comment me to run the test [0.582s]
examples/test_examples.py:TestExampleSimple::test_one -> skipped: comment me to run the test [0.589s]
examples/test_examples.py:TestExampleSimple::test_parametrize[AF_INET6] -> skipped: comment me to run the test [0.582s]
examples/test_examples.py:TestExampleSimple::test_parametrize[AF_INET] -> skipped: comment me to run the test [0.595s]
examples/test_examples.py:TestExampleSimple::test_parametrize[FAMILY_39] -> skipped: comment me to run the test [0.589s]
examples/test_examples.py:TestExampleSimple::test_syscall_failure -> skipped: comment me to run the test [0.590s]
examples/test_examples.py:TestExampleSimple::test_two -> skipped: Required file '/path/file1' not found [0.001s]
examples/test_examples.py:TestExampleSimple::test_with_cleanup -> passed [0.583s]
examples/test_examples.py:TestExampleSimplest::test_one -> skipped: comment me to run the test [0.583s]
examples/test_examples.py:TestVnetDual1::test_ifstat -> skipped: comment me to run the test [0.593s]
examples/test_examples.py:TestVnetSimple::test_ping -> skipped: comment me to run the test [0.589s]
examples/test_examples.py:TestVnetSimple::test_topology -> skipped: comment me to run the test [0.588s]

Results file id is usr_tests.20230903-014520-255324
Results saved to /usr/home/root/.kyua/store/results.usr_tests.20230903-014520-255324.db

12/12 passed (0 failed)


===
Mark Millard
marklmi at yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.