Skip to content
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

crash with openssl 1.1.1u #14

Open
charlesyju opened this issue Dec 18, 2023 · 3 comments
Open

crash with openssl 1.1.1u #14

charlesyju opened this issue Dec 18, 2023 · 3 comments

Comments

@charlesyju
Copy link

I added the include_dirs and library_dirs in setup.py to point to openssl 1.1.1u and built sslkeylog successfully on MacOS 13.3. However it crash with a simple test.

import sslkeylog
sslkeylog.set_keylog("secrets.log")
req = requests.get('https://baidu.com')
Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000000000000001c
Exception Codes:       0x0000000000000001, 0x000000000000001c

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [84537]

VM Region Info: 0x1c is not in any region.  Bytes before following region: 140737488138212
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      shared memory            7ffffffcb000-7ffffffcc000 [    4K] r-x/r-x SM=SHM  

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libcrypto.3.dylib             	       0x108c21c40 OPENSSL_sk_value + 25
1   _sslkeylog.cpython-311-darwin.so	       0x1081fdb16 sslkeylog_set_keylog_callback + 70 (_sslkeylog.c:283)
2   Python                        	       0x107628834 cfunction_call + 90
3   Python                        	       0x1075d8e99 _PyObject_MakeTpCall + 126
4   Python                        	       0x1076d18ab _PyEval_EvalFrameDefault + 57269
5   Python                        	       0x1076d7921 _PyEval_Vector + 92
6   Python                        	       0x1075d90d7 _PyObject_FastCallDictTstate + 87
7   Python                        	       0x107649fb5 slot_tp_new + 191
8   Python                        	       0x1076431b8 type_call + 69
9   Python                        	       0x1075d8e99 _PyObject_MakeTpCall + 126
10  Python                        	       0x1076d18ab _PyEval_EvalFrameDefault + 57269
11  Python                        	       0x1076d7921 _PyEval_Vector + 92
@segevfiner
Copy link
Owner

Then it might very well be that the actual OpenSSL used by your Python install is different. Check out what ssl.OPENSSL_VERSION says for example.

@charlesyju
Copy link
Author

import ssl
print(ssl.OPENSSL_VERSION)

gives the output:

OpenSSL 1.1.1u 30 May 2023

@segevfiner
Copy link
Owner

So another guess would be that the build _sslkeylog dylib is linked with one copy of OpenSSL while Python's _ssl is linked with another. You can check that out using otool -L.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants