@Etresoft @DTS Engineer
Dynamic loading is a basic feature of our language. It's been there 40 years and it worked fine until macOS 15. The OpenSSL libraries are no different, I assume, than any other libraries.
Let's take a step back. We use public, documented APIs for dynamic loading of shared libraries. Is Apple saying we should not use them?
It's not a trivial thing to use the "canonical approach", either.
I keep coming back to two things:
It worked before macOS 15.
lldb hangs when stepping into an OpenSSL library function.
In the spirit of trying to find the problem, I spent hours making a statically linked version. That is, our glue library aclissl3.dylib now statically includes all the OpenSSL functions it needs, from the locally installed libraries. This is all based on OpenSSL 3.0.
I replaced the aclissl3.dylib in the product. Loaded fine. Using it, however, gives me a SEGV:
$ ./alisp
International Allegro CL Free Express Edition
11.0 [64-bit macOS (Apple Silicon)]
CL-USER(1): (progn (require :ssl)(require :aserve))
; Fast loading
; /Applications/AllegroCL64express.app/Contents/Resources/code/SSL.003
;;; Installing ssl patch, version 3.
...
; Foreign loading sys:aclssl3.dylib.
CL-USER(2): (trace excl::rand_add)
(EXCL::RAND_ADD)
CL-USER(3): (net.aserve.client:do-http-request "https://franz.com")
0[3]: (EXCL::RAND_ADD #<Vector @ #x307892d62> 40 40.0d0)
Error: Received signal number 11 (Segmentation fault: 11)
[condition type: SYNCHRONOUS-OPERATING-SYSTEM-SIGNAL]
Restart actions (select using :continue):
0: Return to Top Level (an "abort" restart).
1: Abort entirely from this (lisp) process.
[1] CL-USER(4):
It literally dies on the first call to the first function we call in that library. But, I can't debug it because lldb hangs:
@max[git:master]$ lldb alisp
lldb alisp
(lldb) target create "alisp"
Current executable set to '/Applications/AllegroCL64express.app/Contents/Resources/alisp' (arm64).
(lldb) br s -n RAND_add
br s -n RAND_add
Breakpoint 1: where = libcrypto.46.dylib`RAND_add, address = 0x000000025a7241bc
(lldb) br s -n catch_exception_raise_state
br s -n catch_exception_raise_state
Breakpoint 2: where = alisp`catch_exception_raise_state, address = 0x0000000100003380
(lldb) run
run
Process 49169 launched: '/Applications/AllegroCL64express.app/Contents/Resources/alisp' (arm64)
1 location added to breakpoint 2
International Allegro CL Free Express Edition
11.0 [64-bit macOS (Apple Silicon)]
Copyright (C) 1985-2023, Franz Inc., Lafayette, CA, USA. All Rights Reserved.
This development copy of Allegro CL is licensed to:
Allegro CL 11.0 Express user
;; Optimization settings: safety 1, space 1, speed 1, debug 2,
;; compilation-speed 1.
;; For a complete description of all compiler switches given the
;; current optimization settings evaluate (EXPLAIN-COMPILER-SETTINGS).
CL-USER(1): (progn (require :ssl)(require :aserve))
(progn (require :ssl)(require :aserve))
; Fast loading
; /Applications/AllegroCL64express.app/Contents/Resources/code/SSL.003
;;; Installing ssl patch, version 3.
; Fast loading
; /Applications/AllegroCL64express.app/Contents/Resources/code/OSI.fasl
; Fast loading
; /Applications/AllegroCL64express.app/Contents/Resources/code/fileutil.001
;;; Installing fileutil patch, version 1.
; Fast loading from bundle code/acldns.fasl.
; Fast loading from bundle code/iodefs.fasl.
; Fast loading from bundle code/iordefs.fasl.
; Fast loading from bundle code/efmacs.fasl.
1 location added to breakpoint 1
; Foreign loading sys:aclssl3.dylib.
; Fast loading
; /Applications/AllegroCL64express.app/Contents/Resources/code/ASERVE.001
;;; Installing aserve patch, version 1.
; Fast loading from bundle code/autozoom.fasl.
; Fast loading from bundle zlib/inflate.fasl.
; Fast loading from bundle zlib/deflate.fasl.
; Foreign loading libz.1.dylib.
; Fast loading from bundle code/streamp.fasl.
; Autoloading for class BROADCAST-STREAM:
; Fast loading from bundle code/streamc.fasl.
; Fast loading from bundle code/efft-utf-8s-base.fasl.
; Fast loading from bundle code/efft-utf8-base.fasl.
; Fast loading from bundle code/efft-void.fasl.
; Fast loading from bundle code/efft-latin1-base.fasl.
T
CL-USER(2): (net.aserve.client:do-http-request "https://franz.com")
(net.aserve.client:do-http-request "https://franz.com")
Process 49169 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2
frame #0: 0x00000001025e9cc0 aclssl3.dylib`RAND_add
aclssl3.dylib`RAND_add:
-> 0x1025e9cc0 <+0>: stp d9, d8, [sp, #-0x30]!
0x1025e9cc4 <+4>: stp x20, x19, [sp, #0x10]
0x1025e9cc8 <+8>: stp x29, x30, [sp, #0x20]
0x1025e9ccc <+12>: add x29, sp, #0x20
(lldb) si
This constant "you're doing it wrong" is really frustrating because we've been doing it this way since the first version of macOS. It worked before the upgrade. I'm asking Apple to help us and tell us why.