-
Notifications
You must be signed in to change notification settings - Fork 83
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
tls: Set session only once before Client Hello #607
Conversation
@sreimers Where are the workflow jobs now? I still try to find the reason for the segfault in retest on MaxOS with openssl 1.1.1s. |
Unsure, maybe a github action bug. Can you try a rebase with git push? or a dummy commit. |
Great, it works and we don't know why. :-) |
These warnings seem to be related to the SEGV. At least they are related to the commit.
Enabled This warnings are not printed on:
|
When looking in the code of @sreimers Should we fix the SEGV first? Do you have a Mac installation with openssl 1.1.1s? I expect the SEGV in out:
/* NOTE: close context first */
mem_deref(tt.tls);
mem_deref(tt.sc_cli);
mem_deref(tt.sc_srv);
mem_deref(tt.tc_cli);
mem_deref(tt.tc_srv);
mem_deref(tt.ts); |
This is the backtrace: Better one, with re debug info: * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
* frame #0: 0x000000010038993f libre.11.dylib`hash_apply(h=0xb5b5b5b5b5b5b5b5, ah=(libre.11.dylib`remove_handler at tls.c:1619), arg=0x00000001006047f0) at hash.c:135:14
frame #1: 0x00000001003fa9e1 libre.11.dylib`session_remove_cb(ctx=0x0000000102808200, sess=0x00000001006047f0) at tls.c:1642:9
frame #2: 0x000000010047ccc4 libssl.3.dylib`SSL_CTX_flush_sessions + 153
frame #3: 0x0000000100472b65 libssl.3.dylib`SSL_CTX_free + 149
frame #4: 0x000000010047183b libssl.3.dylib`SSL_free + 770
frame #5: 0x00000001003f66ac libre.11.dylib`destructor(arg=0x000060000391f7d0) at tls_tcp.c:50:3
frame #6: 0x000000010039f046 libre.11.dylib`mem_deref(data=0x000060000391f7d0) at mem.c:376:3
frame #7: 0x0000000100058cd0 retest`test_tls_base(keytype=TLS_KEYTYPE_EC, add_ca=false, exp_verr=80, test_sess_reuse=true, forced_version=771) at tls.c:299:2
frame #8: 0x000000010005835d retest`test_tls_session_reuse_tls_v12 at tls.c:310:9
frame #9: 0x00000001000469f5 retest`test_unit(name=0x0000000000000000, verbose=false) at test.c:506:10
frame #10: 0x0000000100046831 retest`test_reg(name=0x0000000000000000, verbose=false) at test.c:724:8
frame #11: 0x000000010002256a retest`main(argc=0, argv=0x00007ff7bfeffa78) at main.c:233:9
frame #12: 0x00000001000a152e dyld`start + 462 |
Ah, sorry. Didn't update the view and missed your comment. Will remove it again, in order we can solve the SEGV. It is when the SSL is freed. |
Maybe I am able to debug this tomorrow. The question is what is wrong with the |
The object is destroyed, since the pattern is 0xb5b5b5b5 Set the callback handler to NULL in the destructor, or check the deref order. |
@fAuernigg is on vacation and I am not sure. Isn't it a normal situation that the I think there is some cleanup missing after first "round" in the for (i = 0; i < rounds; i++) { |
Alfred, your right! The Edit: The test fails now "normally" without SEGV. |
6c24af3
to
f01207b
Compare
Now I split the PR. |
SEGV fix: #611 This PR has to be re-based later. |
If the server rejects the session reusage then the client should not re-set the session multiple times in function tls_connect() => During the TLS handshaking / After the new session ticket Otherwise the first connection attempt in the rejection-case will fail. Only the second attempt succeeds.
f01207b
to
725d9c7
Compare
This is ready for merge now. |
Thanks! |
If the server rejects the session reusage then
the client should not re-set the session multiple
times in function tls_connect() => During the
TLS handshaking / After the new session ticket
Otherwise the first connection attempt in the
rejection-case will fail. Only the second attempt
succeeds.