MINOR: ssl: set the thread execution context during message callbacks

In order to be able to track memory allocation performed from message
callbacks, let's set the thread execution context to a generic function
pointing to them during their call. This allows for example to observe
the share of SSL allocations caused by ssl_sock_parse_clienthello() when
SSL captures are enabled.

The release calls are automatic from the SSL library for these, and are
registered directly via SSL_get_ex_new_index(). Maybe we should improve
the internal API to wrap that function and systematically track free
calls as well. In this case, maybe even registering the message callback
registration could take both the callback and the release function.
There are few such users however, essentially capture and keylog.
This commit is contained in:
Willy Tarreau 2026-03-11 09:00:24 +01:00
parent 3fb8659d04
commit e8e4449985

View File

@ -2177,7 +2177,8 @@ static __maybe_unused void ssl_sock_msgcbk(int write_p, int version, int content
* ssl_sock_register_msg_callback().
*/
list_for_each_entry(cbk, &ssl_sock_msg_callbacks, list) {
cbk->func(write_p, version, content_type, buf, len, ssl);
EXEC_CTX_NO_RET(EXEC_CTX_MAKE(TH_EX_CTX_FUNC, cbk->func),
cbk->func(write_p, version, content_type, buf, len, ssl));
}
}