From a18c7c616056ebd2a3a6edcfd74bc4bd0fa4c9e9 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Wed, 11 Sep 2024 16:02:50 +0200 Subject: [PATCH] Add quic_lock() calls for functions called from poll_translate_ssl_quic() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Matt Caswell Reviewed-by: Saša Nedvědický (Merged from https://github.com/openssl/openssl/pull/25416) --- ssl/quic/quic_impl.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index 3b9da246691..30b1a20a8d6 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -4855,23 +4855,30 @@ int ossl_quic_conn_poll_events(SSL *ssl, uint64_t events, int do_tick, return 1; } +QUIC_TAKES_LOCK int ossl_quic_get_notifier_fd(SSL *ssl) { QCTX ctx; QUIC_REACTOR *rtor; RIO_NOTIFIER *nfy; + int nfd = -1; if (!expect_quic_any(ssl, &ctx)) return -1; + qctx_lock(&ctx); rtor = ossl_quic_obj_get0_reactor(ctx.obj); nfy = ossl_quic_reactor_get0_notifier(rtor); if (nfy == NULL) - return -1; + goto end; + nfd = ossl_rio_notifier_as_fd(nfy); - return ossl_rio_notifier_as_fd(nfy); + end: + qctx_unlock(&ctx); + return nfd; } +QUIC_TAKES_LOCK void ossl_quic_enter_blocking_section(SSL *ssl, QUIC_REACTOR_WAIT_CTX *wctx) { QCTX ctx; @@ -4880,10 +4887,13 @@ void ossl_quic_enter_blocking_section(SSL *ssl, QUIC_REACTOR_WAIT_CTX *wctx) if (!expect_quic_any(ssl, &ctx)) return; + qctx_lock(&ctx); rtor = ossl_quic_obj_get0_reactor(ctx.obj); ossl_quic_reactor_wait_ctx_enter(wctx, rtor); + qctx_unlock(&ctx); } +QUIC_TAKES_LOCK void ossl_quic_leave_blocking_section(SSL *ssl, QUIC_REACTOR_WAIT_CTX *wctx) { QCTX ctx; @@ -4892,8 +4902,10 @@ void ossl_quic_leave_blocking_section(SSL *ssl, QUIC_REACTOR_WAIT_CTX *wctx) if (!expect_quic_any(ssl, &ctx)) return; + qctx_lock(&ctx); rtor = ossl_quic_obj_get0_reactor(ctx.obj); ossl_quic_reactor_wait_ctx_leave(wctx, rtor); + qctx_unlock(&ctx); } /* -- 2.47.2