From mdounin at mdounin.ru Fri Nov 13 22:38:35 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Sat, 14 Nov 2026 01:38:35 +0300 Subject: [PATCH] Configure: fixed unexpected OpenSSL 4.1 rebuilds Message-ID: <46c1ed98859d6f728151.1794609515@vm-bsd.mdounin.ru> # HG changeset patch # User Maxim Dounin # Date 1794424202 -10800 # Wed Nov 11 22:10:02 2026 +0300 # Node ID 46c1ed98859d6f728151052ad7d2181f497cb720 # Parent 91657301d88f6ca73abba477a0b7224002855bbb Configure: fixed unexpected OpenSSL 4.1 rebuilds. OpenSSL 4.1 no longer reinstalls header files on Unix systems if they weren't changed: https://github.com/openssl/openssl/commit/274cc16ec3eca1c89807de99130c6649b53dc063 This results in unexpected OpenSSL rebuilds if configure with a path to OpenSSL library sources was called again after a previous OpenSSL build, since subsequent OpenSSL builds do not change ssl.h modification time, and objs/Makefile remains newer. The fix is to remove ssl.h in advance when building OpenSSL, so building OpenSSL always updates it. The change in OpenSSL currently affects Unix systems only. However, it might be later extended to win32 builds, hence the relevant MSVC makefile was updated as well. Reported by nisbet-hubbard, https://github.com/freenginx/nginx/pull/40 diff --git a/auto/lib/openssl/make b/auto/lib/openssl/make --- a/auto/lib/openssl/make +++ b/auto/lib/openssl/make @@ -63,6 +63,7 @@ END $OPENSSL/.openssl/include/openssl/ssl.h: $NGX_MAKEFILE cd $OPENSSL \\ + && rm -rf .openssl/include/openssl/ssl.h \\ && if [ -f Makefile ]; then \$(MAKE) clean; fi \\ && ./config --prefix=$ngx_prefix no-shared no-threads $OPENSSL_OPT \\ && \$(MAKE) \\ diff --git a/auto/lib/openssl/makefile.msvc b/auto/lib/openssl/makefile.msvc --- a/auto/lib/openssl/makefile.msvc +++ b/auto/lib/openssl/makefile.msvc @@ -6,6 +6,8 @@ all: cd $(OPENSSL) + del /q /f openssl\include\openssl\ssl.h + perl Configure $(OPENSSL_TARGET) no-shared no-threads \ --prefix="%cd%/openssl" \ --openssldir="%cd%/openssl/ssl" \ From mdounin at mdounin.ru Sun Nov 15 22:35:12 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Mon, 16 Nov 2026 01:35:12 +0300 Subject: [nginx] Version bump. Message-ID: details: http://freenginx.org/hg/nginx/rev/01da25a493e6 branches: changeset: 9604:01da25a493e6 user: Maxim Dounin date: Mon Nov 16 01:33:47 2026 +0300 description: Version bump. diffstat: src/core/nginx.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff --git a/src/core/nginx.h b/src/core/nginx.h --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -9,8 +9,8 @@ #define _NGINX_H_INCLUDED_ -#define nginx_version 1031005 -#define NGINX_VERSION "1.31.5" +#define nginx_version 1031006 +#define NGINX_VERSION "1.31.6" #define freenginx 1 From mdounin at mdounin.ru Sun Nov 15 22:35:13 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Mon, 16 Nov 2026 01:35:13 +0300 Subject: [nginx] Configure: fixed unexpected OpenSSL 4.1 rebuilds. Message-ID: details: http://freenginx.org/hg/nginx/rev/146c43e035ac branches: changeset: 9605:146c43e035ac user: Maxim Dounin date: Mon Nov 16 01:34:12 2026 +0300 description: Configure: fixed unexpected OpenSSL 4.1 rebuilds. OpenSSL 4.1 no longer reinstalls header files on Unix systems if they weren't changed: https://github.com/openssl/openssl/commit/274cc16ec3eca1c89807de99130c6649b53dc063 This results in unexpected OpenSSL rebuilds if configure with a path to OpenSSL library sources was called again after a previous OpenSSL build, since subsequent OpenSSL builds do not change ssl.h modification time, and objs/Makefile remains newer. The fix is to remove ssl.h in advance when building OpenSSL, so building OpenSSL always updates it. The change in OpenSSL currently affects Unix systems only. However, it might be later extended to win32 builds, hence the relevant MSVC makefile was updated as well. Reported by nisbet-hubbard, https://github.com/freenginx/nginx/pull/40 diffstat: auto/lib/openssl/make | 1 + auto/lib/openssl/makefile.msvc | 2 ++ 2 files changed, 3 insertions(+), 0 deletions(-) diffs (23 lines): diff --git a/auto/lib/openssl/make b/auto/lib/openssl/make --- a/auto/lib/openssl/make +++ b/auto/lib/openssl/make @@ -63,6 +63,7 @@ END $OPENSSL/.openssl/include/openssl/ssl.h: $NGX_MAKEFILE cd $OPENSSL \\ + && rm -rf .openssl/include/openssl/ssl.h \\ && if [ -f Makefile ]; then \$(MAKE) clean; fi \\ && ./config --prefix=$ngx_prefix no-shared no-threads $OPENSSL_OPT \\ && \$(MAKE) \\ diff --git a/auto/lib/openssl/makefile.msvc b/auto/lib/openssl/makefile.msvc --- a/auto/lib/openssl/makefile.msvc +++ b/auto/lib/openssl/makefile.msvc @@ -6,6 +6,8 @@ all: cd $(OPENSSL) + del /q /f openssl\include\openssl\ssl.h + perl Configure $(OPENSSL_TARGET) no-shared no-threads \ --prefix="%cd%/openssl" \ --openssldir="%cd%/openssl/ssl" \ From mdounin at mdounin.ru Tue Nov 24 00:27:03 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 03:27:03 +0300 Subject: [PATCH 00 of 10] security and bug fixes Message-ID: Hello! The following patch series addresses issues relevant to freenginx among those recently fixed by F5 as security issues. -- Maxim Dounin From mdounin at mdounin.ru Tue Nov 24 00:27:04 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 03:27:04 +0300 Subject: [PATCH 01 of 10] HTTP/2: fixed send window refunding on stream reset In-Reply-To: References: Message-ID: <8e67e5a054a991801d1f.1795480024@vm-bsd.mdounin.ru> # HG changeset patch # User Maxim Dounin # Date 1795479760 -10800 # Tue Nov 24 03:22:40 2026 +0300 # Node ID 8e67e5a054a991801d1f3de376c7c2c7699cf932 # Parent 146c43e035acbde493604cf4645ac3186a2cc896 HTTP/2: fixed send window refunding on stream reset. Previously, if a stream was terminated, unsent frames were refunded to the connection send window and might make it larger than the allowed maximum, NGX_HTTP_V2_MAX_WINDOW. This in turn made it possible to further increase the window with additional window updates, which were accepted by ngx_http_v2_state_window_update() whenever h2c->send_window was already above NGX_HTTP_V2_MAX_WINDOW, and eventually cause off_t overflow in ngx_http_v2_send_chain(), leading to generation of buffers with negative size. This resulted in segmentation faults and other issues, including code execution on some platforms (CVE-2026-123007). The fix is to make sure that h2c->send_window is never increased above the allowed maximum, NGX_HTTP_V2_MAX_WINDOW. See also: https://github.com/nginx/nginx/commit/e27f5fa84fe6e98505e70bc543b748747dad0a3b diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c --- a/src/http/v2/ngx_http_v2_filter_module.c +++ b/src/http/v2/ngx_http_v2_filter_module.c @@ -1582,7 +1582,14 @@ ngx_http_v2_filter_cleanup(void *data) } } - h2c->send_window += window; + if (window > NGX_HTTP_V2_MAX_WINDOW + || h2c->send_window > NGX_HTTP_V2_MAX_WINDOW - window) + { + h2c->send_window = NGX_HTTP_V2_MAX_WINDOW; + + } else { + h2c->send_window += window; + } } From mdounin at mdounin.ru Tue Nov 24 00:27:05 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 03:27:05 +0300 Subject: [PATCH 02 of 10] HTTP/2: improved window updates checking In-Reply-To: References: Message-ID: # HG changeset patch # User Maxim Dounin # Date 1795479766 -10800 # Tue Nov 24 03:22:46 2026 +0300 # Node ID a793fa576435e45acbbfc92fb3294836120bf2af # Parent 8e67e5a054a991801d1f3de376c7c2c7699cf932 HTTP/2: improved window updates checking. Window updates are now rejected as long as the current send window is larger than NGX_HTTP_V2_MAX_WINDOW minus the window update sent by the client, so no overflows or underflows are possible. Additionally, the check on the window update itself ensures it is no larger than the maximum (which is not possible per protocol, so the check is provided for clarity). This ensures that window updates are properly rejected even if the current send window happens to be larger than NGX_HTTP_V2_MAX_WINDOW for some reason. diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -2491,8 +2491,10 @@ ngx_http_v2_state_window_update(ngx_http stream = node->stream; - if (window > (size_t) (NGX_HTTP_V2_MAX_WINDOW - stream->send_window)) { - + if (window > NGX_HTTP_V2_MAX_WINDOW + || stream->send_window + > (ssize_t) (NGX_HTTP_V2_MAX_WINDOW - window)) + { ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, "client violated flow control for stream %ui: " "received WINDOW_UPDATE frame " @@ -2529,7 +2531,9 @@ ngx_http_v2_state_window_update(ngx_http return ngx_http_v2_state_complete(h2c, pos, end); } - if (window > NGX_HTTP_V2_MAX_WINDOW - h2c->send_window) { + if (window > NGX_HTTP_V2_MAX_WINDOW + || h2c->send_window > NGX_HTTP_V2_MAX_WINDOW - window) + { ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, "client violated connection flow control: " "received WINDOW_UPDATE frame " From mdounin at mdounin.ru Tue Nov 24 00:27:06 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 03:27:06 +0300 Subject: [PATCH 03 of 10] gRPC: improved window update checking In-Reply-To: References: Message-ID: # HG changeset patch # User Maxim Dounin # Date 1795479768 -10800 # Tue Nov 24 03:22:48 2026 +0300 # Node ID f0af3674e99a92f62b3526ed4bf3df762f422323 # Parent a793fa576435e45acbbfc92fb3294836120bf2af gRPC: improved window update checking. Following changes in HTTP/2, window updates are now rejected as long as the current send window is larger than NGX_HTTP_V2_MAX_WINDOW minus the window update sent by the client, so no overflows or underflows are possible. Additionally, the check on the window update itself ensures it is no larger than the maximum (which is not possible per protocol, so the check is provided for clarity). This ensures that window updates are properly rejected even if the current send window happens to be larger than NGX_HTTP_V2_MAX_WINDOW for some reason. diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c --- a/src/http/modules/ngx_http_grpc_module.c +++ b/src/http/modules/ngx_http_grpc_module.c @@ -3842,8 +3842,9 @@ ngx_http_grpc_parse_window_update(ngx_ht if (ctx->stream_id) { - if (ctx->window_update > (size_t) NGX_HTTP_V2_MAX_WINDOW - - ctx->send_window) + if (ctx->window_update > NGX_HTTP_V2_MAX_WINDOW + || ctx->send_window > (ssize_t) (NGX_HTTP_V2_MAX_WINDOW + - ctx->window_update)) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "upstream sent too large window update"); @@ -3855,7 +3856,8 @@ ngx_http_grpc_parse_window_update(ngx_ht } else { if (ctx->window_update > NGX_HTTP_V2_MAX_WINDOW - - ctx->connection->send_window) + || ctx->connection->send_window > NGX_HTTP_V2_MAX_WINDOW + - ctx->window_update) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "upstream sent too large window update"); From mdounin at mdounin.ru Tue Nov 24 00:27:07 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 03:27:07 +0300 Subject: [PATCH 04 of 10] HTTP/2: modified ngx_http_v2_send_chain() loop to be safer In-Reply-To: References: Message-ID: # HG changeset patch # User Maxim Dounin # Date 1795479772 -10800 # Tue Nov 24 03:22:52 2026 +0300 # Node ID e1b8bf142baffa8dd81f11e47d654f63be405bdf # Parent f0af3674e99a92f62b3526ed4bf3df762f422323 HTTP/2: modified ngx_http_v2_send_chain() loop to be safer. Previously, the loop used a "limit == 0" condition, and only at the end of the loop. In case of other issues, such as "limit" being negative due to h2c->send_window being large enough to overflow off_t, this resulted in incorrect buffer construction and subsequent segmentation faults or memory corruption. With the change, "limit > 0" is checked as the loop condition, and this ensures that the loop is safely terminated if "limit" ever becomes negative due to a bug, diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c --- a/src/http/v2/ngx_http_v2_filter_module.c +++ b/src/http/v2/ngx_http_v2_filter_module.c @@ -975,7 +975,7 @@ ngx_http_v2_send_chain(ngx_connection_t cl = NULL; #endif - for ( ;; ) { + while (limit > 0) { if ((off_t) frame_size > limit) { frame_size = (size_t) limit; } @@ -1070,10 +1070,6 @@ ngx_http_v2_send_chain(ngx_connection_t } limit -= frame_size; - - if (limit == 0) { - break; - } } if (offset) { From mdounin at mdounin.ru Tue Nov 24 00:27:08 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 03:27:08 +0300 Subject: [PATCH 05 of 10] SSL: added buffer checks to ngx_ssl_send_chain() In-Reply-To: References: Message-ID: <719ce1a193bf691cf9d3.1795480028@vm-bsd.mdounin.ru> # HG changeset patch # User Maxim Dounin # Date 1795479774 -10800 # Tue Nov 24 03:22:54 2026 +0300 # Node ID 719ce1a193bf691cf9d3bc933d81cb5755922b33 # Parent e1b8bf142baffa8dd81f11e47d654f63be405bdf SSL: added buffer checks to ngx_ssl_send_chain(). Similarly to buffer checks present in ngx_http_write_filter() and ngx_output_chain(), these checks are expected to catch invalid buffers if passed to the SSL layer. Notably, this is expected to improve the safety of HTTP/2, which performs complex buffer manipulations after the write filter checks. diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c @@ -3191,6 +3191,42 @@ ngx_ssl_send_chain(ngx_connection_t *c, continue; } + if (ngx_buf_size(in->buf) == 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "zero size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + + if (ngx_buf_size(in->buf) < 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "negative size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + n = ngx_ssl_write(c, in->buf->pos, in->buf->last - in->buf->pos); if (n == NGX_ERROR) { @@ -3255,6 +3291,42 @@ ngx_ssl_send_chain(ngx_connection_t *c, continue; } + if (ngx_buf_size(in->buf) == 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "zero size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + + if (ngx_buf_size(in->buf) < 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "negative size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + if (in->buf->in_file && c->ssl->sendfile) { flush = 1; break; From mdounin at mdounin.ru Tue Nov 24 00:27:09 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 03:27:09 +0300 Subject: [PATCH 06 of 10] HTTP/2: reset reusable connection status on stream creation In-Reply-To: References: Message-ID: <3ca0668f28f7ebf64b5a.1795480029@vm-bsd.mdounin.ru> # HG changeset patch # User Roman Arutyunyan # Date 1789647011 -14400 # Thu Sep 17 16:10:11 2026 +0400 # Node ID 3ca0668f28f7ebf64b5a458959ed9fe9356b0438 # Parent 719ce1a193bf691cf9d3bc933d81cb5755922b33 HTTP/2: reset reusable connection status on stream creation. Previously, an HTTP/2 connection could be reusable while having streams. This could result in an attempt to drain the connection while processing one if its streams, for example when connecting to an upstream. After recognizing that the connection has streams, an attempt to send the GOAWAY frame was made. On send failure, the connection was immediately closed and its pool released. This triggered a use-after-free up the stack. Having an HTTP/2 connection with streams registered as reusable became possible after 76672e650. A connection with no streams and a partial frame read from client was registered as reusable to avoid DoS attacks. So if a client sends only the first HEADERS frame byte, the connection becomes reusable. Later, when the remaining HEADERS bytes are received and a new stream is created, the reusable status is not reset until the connection becomes idle. Fix is to mark the connection non-reusable upon stream creation. Reported by Albert @ Vexera AI. Obtained from: https://github.com/nginx/nginx/commit/2df48a501d0fb8212b7d39dffeeff5876332ba59 diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -3158,6 +3158,8 @@ ngx_http_v2_create_stream(ngx_http_v2_co h2c->processing++; + ngx_reusable_connection(h2c->connection, 0); + h2c->priority_limit += h2scf->concurrent_streams; if (h2c->connection->read->timer_set) { From mdounin at mdounin.ru Tue Nov 24 00:27:10 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 03:27:10 +0300 Subject: [PATCH 07 of 10] QUIC: avoid main connection reuse after creating a stream In-Reply-To: References: Message-ID: <90dde4a8dc4da2fe1bb0.1795480030@vm-bsd.mdounin.ru> # HG changeset patch # User Roman Arutyunyan # Date 1793537182 -14400 # Sun Nov 01 16:46:22 2026 +0400 # Node ID 90dde4a8dc4da2fe1bb0adc6ea063d08206e6186 # Parent 3ca0668f28f7ebf64b5a458959ed9fe9356b0438 QUIC: avoid main connection reuse after creating a stream. Previously, ngx_quic_create_stream() cleared the main connection's reusable flag and then called ngx_get_connection() before inserting the new stream into the tree. If the worker was low on free connections, the drain inside ngx_get_connection() could close an idle stream of the same main connection. Since the new stream was not in the tree yet, that close found no remaining streams and marked the main connection reusable again. Once reusable, the connection could later be drained while processing one of its streams, for example when connecting to an upstream, freeing it while still in use. Fix is to insert the new stream into the tree before calling ngx_get_connection(), so the main connection is not considered idle. Reported by Xint.io. Obtained from: https://github.com/nginx/nginx/commit/b5252dae1ca0d4c516b8bcffd9fa7fd967b73075 diff --git a/src/event/quic/ngx_event_quic_streams.c b/src/event/quic/ngx_event_quic_streams.c --- a/src/event/quic/ngx_event_quic_streams.c +++ b/src/event/quic/ngx_event_quic_streams.c @@ -723,12 +723,15 @@ ngx_quic_create_stream(ngx_connection_t addr_text.data = NULL; } + ngx_rbtree_insert(&qc->streams.tree, &qs->node); + reusable = c->reusable; ngx_reusable_connection(c, 0); sc = ngx_get_connection(c->fd, log); if (sc == NULL) { ngx_destroy_pool(pool); + ngx_rbtree_delete(&qc->streams.tree, &qs->node); ngx_queue_insert_tail(&qc->streams.free, &qs->queue); ngx_reusable_connection(c, reusable); return NULL; @@ -795,6 +798,7 @@ ngx_quic_create_stream(ngx_connection_t if (cln == NULL) { ngx_close_connection(sc); ngx_destroy_pool(pool); + ngx_rbtree_delete(&qc->streams.tree, &qs->node); ngx_queue_insert_tail(&qc->streams.free, &qs->queue); ngx_reusable_connection(c, reusable); return NULL; @@ -803,8 +807,6 @@ ngx_quic_create_stream(ngx_connection_t cln->handler = ngx_quic_stream_cleanup_handler; cln->data = sc; - ngx_rbtree_insert(&qc->streams.tree, &qs->node); - return qs; } From mdounin at mdounin.ru Tue Nov 24 00:27:11 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 03:27:11 +0300 Subject: [PATCH 08 of 10] Mail: blocked client write events during various operations In-Reply-To: References: Message-ID: <44b4a8b577914dac92d0.1795480031@vm-bsd.mdounin.ru> # HG changeset patch # User Maxim Dounin # Date 1795479850 -10800 # Tue Nov 24 03:24:10 2026 +0300 # Node ID 44b4a8b577914dac92d0c22fb40716986ef1c7b6 # Parent 90dde4a8dc4da2fe1bb0adc6ea063d08206e6186 Mail: blocked client write events during various operations. Previously, only read events were blocked during various operations, notably during auth_http requests, connecting to upstream servers, and DNS resolution in SMTP. With ngx_mail_send() as a write event handler, this might result in use-after-free if ngx_mail_send() is called due to a write event and closes the session due to an error, while an ongoing operation, such as an auth_http request, still references it (CVE-2026-113425). The fix is to block write events similarly to how read events are currently blocked during corresponding operations. See also: https://github.com/nginx/nginx/commit/df9d8d940ecb83a50b1e55ccc296d0a29cfe774c https://github.com/nginx/nginx/commit/e2d23d45fa93ed236a9cdedcb54271e0a064c4f3 https://github.com/nginx/nginx/commit/5deda780a9d5d1bcd5c6731d3118fa090ae900cc https://github.com/nginx/nginx/commit/4c5ace9f1d5419334a2e6772a0885ee7ed3d6e91 diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c --- a/src/mail/ngx_mail_auth_http_module.c +++ b/src/mail/ngx_mail_auth_http_module.c @@ -74,6 +74,7 @@ static void ngx_mail_auth_send_error(ngx static ngx_int_t ngx_mail_auth_http_parse_header_line(ngx_mail_session_t *s, ngx_mail_auth_http_ctx_t *ctx); static void ngx_mail_auth_http_block_read(ngx_event_t *rev); +static void ngx_mail_auth_http_block_write(ngx_event_t *wev); static void ngx_mail_auth_http_dummy_handler(ngx_event_t *ev); static ngx_buf_t *ngx_mail_auth_http_create_request(ngx_mail_session_t *s, ngx_pool_t *pool, ngx_mail_auth_http_conf_t *ahcf); @@ -231,6 +232,7 @@ ngx_mail_auth_http_init(ngx_mail_session ctx->peer.connection->pool = s->connection->pool; s->connection->read->handler = ngx_mail_auth_http_block_read; + s->connection->write->handler = ngx_mail_auth_http_block_write; ctx->peer.connection->read->handler = ngx_mail_auth_http_read_handler; ctx->peer.connection->write->handler = ngx_mail_auth_http_write_handler; @@ -783,6 +785,8 @@ ngx_mail_auth_http_process_headers(ngx_m ngx_close_connection(ctx->peer.connection); + s->connection->write->handler = ngx_mail_send; + if (ctx->err.len) { ngx_log_error(NGX_LOG_INFO, s->connection->log, 0, @@ -1254,6 +1258,29 @@ ngx_mail_auth_http_block_read(ngx_event_ static void +ngx_mail_auth_http_block_write(ngx_event_t *wev) +{ + ngx_connection_t *c; + ngx_mail_session_t *s; + ngx_mail_auth_http_ctx_t *ctx; + + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, + "mail auth http block write"); + + if (ngx_handle_write_event(wev, 0) != NGX_OK) { + c = wev->data; + s = c->data; + + ctx = ngx_mail_get_module_ctx(s, ngx_mail_auth_http_module); + + ngx_close_connection(ctx->peer.connection); + ngx_destroy_pool(ctx->pool); + ngx_mail_session_internal_server_error(s); + } +} + + +static void ngx_mail_auth_http_dummy_handler(ngx_event_t *ev) { ngx_log_debug0(NGX_LOG_DEBUG_MAIL, ev->log, 0, diff --git a/src/mail/ngx_mail_proxy_module.c b/src/mail/ngx_mail_proxy_module.c --- a/src/mail/ngx_mail_proxy_module.c +++ b/src/mail/ngx_mail_proxy_module.c @@ -24,6 +24,7 @@ typedef struct { static void ngx_mail_proxy_block_read(ngx_event_t *rev); +static void ngx_mail_proxy_block_write(ngx_event_t *wev); static void ngx_mail_proxy_pop3_handler(ngx_event_t *rev); static void ngx_mail_proxy_imap_handler(ngx_event_t *rev); static void ngx_mail_proxy_smtp_handler(ngx_event_t *rev); @@ -165,6 +166,7 @@ ngx_mail_proxy_init(ngx_mail_session_t * p->upstream.connection->pool = s->connection->pool; s->connection->read->handler = ngx_mail_proxy_block_read; + s->connection->write->handler = ngx_mail_proxy_block_write; p->upstream.connection->write->handler = ngx_mail_proxy_write_handler; pcf = ngx_mail_get_module_srv_conf(s, ngx_mail_proxy_module); @@ -224,6 +226,23 @@ ngx_mail_proxy_block_read(ngx_event_t *r static void +ngx_mail_proxy_block_write(ngx_event_t *wev) +{ + ngx_connection_t *c; + ngx_mail_session_t *s; + + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, "mail proxy block write"); + + if (ngx_handle_read_event(wev, 0) != NGX_OK) { + c = wev->data; + s = c->data; + + ngx_mail_proxy_close_session(s); + } +} + + +static void ngx_mail_proxy_pop3_handler(ngx_event_t *rev) { u_char *p; diff --git a/src/mail/ngx_mail_smtp_handler.c b/src/mail/ngx_mail_smtp_handler.c --- a/src/mail/ngx_mail_smtp_handler.c +++ b/src/mail/ngx_mail_smtp_handler.c @@ -16,6 +16,7 @@ static void ngx_mail_smtp_resolve_addr_h static void ngx_mail_smtp_resolve_name(ngx_event_t *rev); static void ngx_mail_smtp_resolve_name_handler(ngx_resolver_ctx_t *ctx); static void ngx_mail_smtp_block_reading(ngx_event_t *rev); +static void ngx_mail_smtp_block_writing(ngx_event_t *wev); static void ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c); static void ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev); static ngx_int_t ngx_mail_smtp_create_buffer(ngx_mail_session_t *s, @@ -91,6 +92,7 @@ ngx_mail_smtp_init_session(ngx_mail_sess s->resolver_ctx = ctx; c->read->handler = ngx_mail_smtp_block_reading; + c->write->handler = ngx_mail_smtp_block_writing; if (ngx_resolve_addr(ctx) != NGX_OK) { ngx_mail_close_connection(c); @@ -278,6 +280,38 @@ ngx_mail_smtp_block_reading(ngx_event_t static void +ngx_mail_smtp_block_writing(ngx_event_t *wev) +{ + ngx_connection_t *c; + ngx_mail_session_t *s; + ngx_resolver_ctx_t *ctx; + + c = wev->data; + s = c->data; + + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, c->log, 0, "smtp writing blocked"); + + if (ngx_handle_write_event(wev, 0) != NGX_OK) { + + if (s->resolver_ctx) { + ctx = s->resolver_ctx; + + if (ctx->handler == ngx_mail_smtp_resolve_addr_handler) { + ngx_resolve_addr_done(ctx); + + } else if (ctx->handler == ngx_mail_smtp_resolve_name_handler) { + ngx_resolve_name_done(ctx); + } + + s->resolver_ctx = NULL; + } + + ngx_mail_close_connection(c); + } +} + + +static void ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c) { ngx_msec_t timeout; @@ -307,6 +341,7 @@ ngx_mail_smtp_greeting(ngx_mail_session_ } c->read->handler = ngx_mail_smtp_init_protocol; + c->write->handler = ngx_mail_send; s->out = sscf->greeting; @@ -336,6 +371,7 @@ ngx_mail_smtp_invalid_pipelining(ngx_eve cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module); c->read->handler = ngx_mail_smtp_init_protocol; + c->write->handler = ngx_mail_send; ngx_add_timer(c->read, cscf->timeout); From mdounin at mdounin.ru Tue Nov 24 00:27:12 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 03:27:12 +0300 Subject: [PATCH 09 of 10] Resolver: reworked ctx->handler calls In-Reply-To: References: Message-ID: <1da25011f59c17128736.1795480032@vm-bsd.mdounin.ru> # HG changeset patch # User Maxim Dounin # Date 1795479906 -10800 # Tue Nov 24 03:25:06 2026 +0300 # Node ID 1da25011f59c171287369585748a1117a42d9322 # Parent 44b4a8b577914dac92d0c22fb40716986ef1c7b6 Resolver: reworked ctx->handler calls. Previously, all resolver contexts were detached from the rn->waiting list when reporting resolution results via corresponding ctx->handler() calls. And if a handler call caused another resolver context on the same list to be freed via the ngx_resolver_name_done() or ngx_resolve_addr_done() call, as can happen with subrequests, this resulted in "could not cancel ... resolving" alerts and then use-after-free when ctx->handler() was subsequently called for the freed context (CVE-2026-123634, though security impact is questionable). The fix is to keep all contexts linked to rn->waiting and detach them one by one, so the contexts which are freed elsewhere are removed from the list. See also: https://github.com/nginx/nginx/commit/e39708edc69a9c0c992b6af075db761946969534 diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c --- a/src/core/ngx_resolver.c +++ b/src/core/ngx_resolver.c @@ -112,6 +112,8 @@ static void *ngx_resolver_calloc(ngx_res static void ngx_resolver_free(ngx_resolver_t *r, void *p); static void ngx_resolver_free_locked(ngx_resolver_t *r, void *p); static void *ngx_resolver_dup(ngx_resolver_t *r, void *src, size_t size); +static void ngx_resolver_link_waiting(ngx_resolver_t *r, + ngx_resolver_node_t *rn, ngx_resolver_ctx_t *ctx); static ngx_resolver_addr_t *ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn, ngx_uint_t rotate); static void ngx_resolver_report_srv(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx); @@ -612,7 +614,6 @@ ngx_resolve_name_locked(ngx_resolver_t * ngx_uint_t i, naddrs; ngx_queue_t *resend_queue, *expire_queue; ngx_rbtree_t *tree; - ngx_resolver_ctx_t *next, *last; ngx_resolver_addr_t *addrs; ngx_resolver_node_t *rn; @@ -637,9 +638,6 @@ ngx_resolve_name_locked(ngx_resolver_t * if (rn) { - /* ctx can be a list after NGX_RESOLVE_CNAME */ - for (last = ctx; last->next; last = last->next); - if (rn->valid >= ngx_time()) { ngx_log_debug0(NGX_LOG_DEBUG_CORE, r->log, 0, "resolve cached"); @@ -667,12 +665,12 @@ ngx_resolve_name_locked(ngx_resolver_t * } } - last->next = rn->waiting; - rn->waiting = NULL; - - /* unlock name mutex */ - - do { + ngx_resolver_link_waiting(r, rn, ctx); + + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = NGX_OK; ctx->valid = rn->valid; ctx->naddrs = naddrs; @@ -689,12 +687,8 @@ ngx_resolve_name_locked(ngx_resolver_t * ctx->addrs = addrs; } - next = ctx->next; - ctx->handler(ctx); - - ctx = next; - } while (ctx); + } if (addrs != NULL) { ngx_resolver_free(r, addrs->sockaddr); @@ -705,18 +699,14 @@ ngx_resolve_name_locked(ngx_resolver_t * } if (rn->nsrvs) { - last->next = rn->waiting; - rn->waiting = NULL; - - /* unlock name mutex */ - - do { - next = ctx->next; + ngx_resolver_link_waiting(r, rn, ctx); + + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; ngx_resolver_resolve_srv_names(ctx, rn); - - ctx = next; - } while (ctx); + } return NGX_OK; } @@ -731,20 +721,17 @@ ngx_resolve_name_locked(ngx_resolver_t * return ngx_resolve_name_locked(r, ctx, &cname); } - last->next = rn->waiting; - rn->waiting = NULL; - - /* unlock name mutex */ - - do { + ngx_resolver_link_waiting(r, rn, ctx); + + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = NGX_RESOLVE_NXDOMAIN; ctx->valid = ngx_time() + (r->valid ? r->valid : 10); - next = ctx->next; ctx->handler(ctx); - - ctx = next; - } while (ctx); + } return NGX_OK; } @@ -754,16 +741,11 @@ ngx_resolve_name_locked(ngx_resolver_t * return NGX_ERROR; } - last->next = rn->waiting; - rn->waiting = ctx; + ngx_resolver_link_waiting(r, rn, ctx); + ctx->state = NGX_AGAIN; ctx->async = 1; - do { - ctx->node = rn; - ctx = ctx->next; - } while (ctx); - return NGX_AGAIN; } @@ -824,6 +806,7 @@ ngx_resolve_name_locked(ngx_resolver_t * #if (NGX_HAVE_INET6) rn->query6 = NULL; #endif + rn->waiting = NULL; ngx_rbtree_insert(tree, &rn->node); } @@ -842,19 +825,21 @@ ngx_resolve_name_locked(ngx_resolver_t * if (rc == NGX_DECLINED) { ngx_rbtree_delete(tree, &rn->node); + ngx_resolver_link_waiting(r, rn, ctx); + + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + + ctx->state = NGX_RESOLVE_NXDOMAIN; + + ctx->handler(ctx); + } + ngx_resolver_free(r, rn->query); ngx_resolver_free(r, rn->name); ngx_resolver_free(r, rn); - do { - ctx->state = NGX_RESOLVE_NXDOMAIN; - next = ctx->next; - - ctx->handler(ctx); - - ctx = next; - } while (ctx); - return NGX_OK; } @@ -899,16 +884,12 @@ ngx_resolve_name_locked(ngx_resolver_t * rn->cnlen = 0; rn->valid = 0; rn->ttl = NGX_MAX_UINT32_VALUE; - rn->waiting = ctx; + + ngx_resolver_link_waiting(r, rn, ctx); ctx->state = NGX_AGAIN; ctx->async = 1; - do { - ctx->node = rn; - ctx = ctx->next; - } while (ctx); - return NGX_AGAIN; failed: @@ -1021,11 +1002,10 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx return NGX_ERROR; } - ctx->next = rn->waiting; - rn->waiting = ctx; + ngx_resolver_link_waiting(r, rn, ctx); + ctx->state = NGX_AGAIN; ctx->async = 1; - ctx->node = rn; /* unlock addr mutex */ @@ -1063,6 +1043,7 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx #if (NGX_HAVE_INET6) rn->query6 = NULL; #endif + rn->waiting = NULL; ngx_rbtree_insert(tree, &rn->node); } @@ -1114,13 +1095,13 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx rn->nlen = 0; rn->valid = 0; rn->ttl = NGX_MAX_UINT32_VALUE; - rn->waiting = ctx; + + ngx_resolver_link_waiting(r, rn, ctx); /* unlock addr mutex */ ctx->state = NGX_AGAIN; ctx->async = 1; - ctx->node = rn; return NGX_OK; @@ -2128,20 +2109,16 @@ ngx_resolver_process_a(ngx_resolver_t *r } #endif - next = rn->waiting; - rn->waiting = NULL; - ngx_queue_remove(&rn->queue); ngx_rbtree_delete(&r->name_rbtree, &rn->node); - /* unlock name mutex */ - - while (next) { - ctx = next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = code; ctx->valid = ngx_time() + (r->valid ? r->valid : 10); - next = ctx->next; ctx->handler(ctx); } @@ -2447,13 +2424,10 @@ ngx_resolver_process_a(ngx_resolver_t *r ngx_queue_insert_head(&r->name_expire_queue, &rn->queue); - next = rn->waiting; - rn->waiting = NULL; - - /* unlock name mutex */ - - while (next) { - ctx = next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = NGX_OK; ctx->valid = rn->valid; ctx->naddrs = naddrs; @@ -2470,8 +2444,6 @@ ngx_resolver_process_a(ngx_resolver_t *r ctx->addrs = addrs; } - next = ctx->next; - ctx->handler(ctx); } @@ -2526,26 +2498,25 @@ ngx_resolver_process_a(ngx_resolver_t *r #endif ctx = rn->waiting; - rn->waiting = NULL; if (ctx) { if (ctx->recursion++ >= NGX_RESOLVER_MAX_RECURSION) { - /* unlock name mutex */ - do { ctx->state = NGX_RESOLVE_NXDOMAIN; - next = ctx->next; + rn->waiting = ctx->next; ctx->handler(ctx); - ctx = next; + ctx = rn->waiting; } while (ctx); return; } + rn->waiting = NULL; + for (next = ctx; next; next = next->next) { next->node = NULL; } @@ -2553,8 +2524,6 @@ ngx_resolver_process_a(ngx_resolver_t *r (void) ngx_resolve_name_locked(r, ctx, &name); } - /* unlock name mutex */ - return; } @@ -2672,18 +2641,16 @@ ngx_resolver_process_srv(ngx_resolver_t } if (code) { - next = rn->waiting; - rn->waiting = NULL; - ngx_queue_remove(&rn->queue); ngx_rbtree_delete(&r->srv_rbtree, &rn->node); - while (next) { - ctx = next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = code; ctx->valid = ngx_time() + (r->valid ? r->valid : 10); - next = ctx->next; ctx->handler(ctx); } @@ -2868,12 +2835,9 @@ ngx_resolver_process_srv(ngx_resolver_t ngx_queue_insert_head(&r->srv_expire_queue, &rn->queue); - next = rn->waiting; - rn->waiting = NULL; - - while (next) { - ctx = next; - next = ctx->next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; ngx_resolver_resolve_srv_names(ctx, rn); } @@ -2911,26 +2875,25 @@ ngx_resolver_process_srv(ngx_resolver_t #endif ctx = rn->waiting; - rn->waiting = NULL; if (ctx) { if (ctx->recursion++ >= NGX_RESOLVER_MAX_RECURSION) { - /* unlock name mutex */ - do { ctx->state = NGX_RESOLVE_NXDOMAIN; - next = ctx->next; + rn->waiting = ctx->next; ctx->handler(ctx); - ctx = next; + ctx = rn->waiting; } while (ctx); return; } + rn->waiting = NULL; + for (next = ctx; next; next = next->next) { next->node = NULL; } @@ -2938,8 +2901,6 @@ ngx_resolver_process_srv(ngx_resolver_t (void) ngx_resolve_name_locked(r, ctx, &name); } - /* unlock name mutex */ - return; } @@ -3112,7 +3073,7 @@ ngx_resolver_process_ptr(ngx_resolver_t ngx_queue_t *expire_queue; ngx_rbtree_t *tree; ngx_resolver_an_t *an; - ngx_resolver_ctx_t *ctx, *next; + ngx_resolver_ctx_t *ctx; ngx_resolver_node_t *rn; #if (NGX_HAVE_INET6) uint32_t hash; @@ -3237,20 +3198,16 @@ valid: } if (code) { - next = rn->waiting; - rn->waiting = NULL; - ngx_queue_remove(&rn->queue); ngx_rbtree_delete(tree, &rn->node); - /* unlock addr mutex */ - - while (next) { - ctx = next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = code; ctx->valid = ngx_time() + (r->valid ? r->valid : 10); - next = ctx->next; ctx->handler(ctx); } @@ -3376,17 +3333,13 @@ ptr: ngx_queue_insert_head(expire_queue, &rn->queue); - next = rn->waiting; - rn->waiting = NULL; - - /* unlock addr mutex */ - - while (next) { - ctx = next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = NGX_OK; ctx->valid = rn->valid; ctx->name = name; - next = ctx->next; ctx->handler(ctx); } @@ -4216,6 +4169,23 @@ ngx_resolver_dup(ngx_resolver_t *r, void } +static void +ngx_resolver_link_waiting(ngx_resolver_t *r, ngx_resolver_node_t *rn, + ngx_resolver_ctx_t *ctx) +{ + ngx_resolver_ctx_t *last; + + for (last = ctx; last->next; last = last->next) { + last->node = rn; + } + + last->node = rn; + last->next = rn->waiting; + + rn->waiting = ctx; +} + + static ngx_resolver_addr_t * ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn, ngx_uint_t rotate) From mdounin at mdounin.ru Tue Nov 24 00:27:13 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 03:27:13 +0300 Subject: [PATCH 10 of 10] Disabled repeated posts of write events without progress In-Reply-To: References: Message-ID: # HG changeset patch # User Maxim Dounin # Date 1795479910 -10800 # Tue Nov 24 03:25:10 2026 +0300 # Node ID c77a4ec02febc04371a0e56083fecd8bf2aae531 # Parent 1da25011f59c171287369585748a1117a42d9322 Disabled repeated posts of write events without progress. Previously, since 7947:51a260276425 in write filter and 7949:862f6130d357 in output chain, write events were posted for the next event loop operation if there were unsent data and the connection was still ready for writing. However, with SSL the c->write->ready flag might still be set when writing isn't possible, such as when SSL_write() returns SSL_ERROR_WANT_READ (which might be the case during a handshake when responding to early data, or during renegotiation with an upstream server). This could cause some excessive CPU usage until the timeout expires (known as CVE-2026-132779, though security impact in freenginx is questionable). The fix is to post write events only if some progress was made, similarly to how we rearm write timeouts (9358:4c872940b19b). See also: https://github.com/nginx/nginx/commit/2c84628229bdeedd16db5980af6e8fdf754cc80d https://github.com/nginx/nginx/commit/a12a232e6472b39a53b5e31266846843e142950d diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c --- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -658,7 +658,7 @@ ngx_chain_writer(void *data, ngx_chain_t { ngx_chain_writer_ctx_t *ctx = data; - off_t size; + off_t size, sent; ngx_chain_t *cl, *ln, *chain; ngx_connection_t *c; @@ -775,6 +775,8 @@ ngx_chain_writer(void *data, ngx_chain_t return NGX_OK; } + sent = c->sent; + chain = c->send_chain(c, ctx->out, ctx->limit); ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0, @@ -784,7 +786,7 @@ ngx_chain_writer(void *data, ngx_chain_t return NGX_ERROR; } - if (chain && c->write->ready) { + if (chain && c->write->ready && c->sent != sent) { ngx_post_event(c->write, &ngx_posted_next_events); } diff --git a/src/http/ngx_http_write_filter_module.c b/src/http/ngx_http_write_filter_module.c --- a/src/http/ngx_http_write_filter_module.c +++ b/src/http/ngx_http_write_filter_module.c @@ -336,7 +336,7 @@ ngx_http_write_filter(ngx_http_request_t } } - if (chain && c->write->ready && !c->write->delayed) { + if (chain && c->write->ready && !c->write->delayed && c->sent != sent) { ngx_post_event(c->write, &ngx_posted_next_events); } From mdounin at mdounin.ru Tue Nov 24 02:46:29 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 05:46:29 +0300 Subject: [PATCH] Configure: fixed clean OpenSSL builds on Windows Message-ID: <963bfb9be4bb29597936.1795488389@vm-bsd.mdounin.ru> # HG changeset patch # User Maxim Dounin # Date 1795484152 -10800 # Tue Nov 24 04:35:52 2026 +0300 # Node ID 963bfb9be4bb29597936484c80e8514e25982d51 # Parent 146c43e035acbde493604cf4645ac3186a2cc896 Configure: fixed clean OpenSSL builds on Windows. Calling "del" on Windows fails if the target file does not exist, so the change in 9605:146c43e035ac broke clean OpenSSL builds on Windows. The fix is to test if the file exists before trying to delete it. diff --git a/auto/lib/openssl/makefile.msvc b/auto/lib/openssl/makefile.msvc --- a/auto/lib/openssl/makefile.msvc +++ b/auto/lib/openssl/makefile.msvc @@ -6,7 +6,8 @@ all: cd $(OPENSSL) - del /q /f openssl\include\openssl\ssl.h + if exist openssl\include\openssl\ssl.h \ + del /q /f openssl\include\openssl\ssl.h perl Configure $(OPENSSL_TARGET) no-shared no-threads \ --prefix="%cd%/openssl" \ From mdounin at mdounin.ru Tue Nov 24 15:44:03 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:03 +0300 Subject: [nginx] Configure: fixed clean OpenSSL builds on Windows. Message-ID: details: http://freenginx.org/hg/nginx/rev/2027afa36398 branches: changeset: 9606:2027afa36398 user: Maxim Dounin date: Tue Nov 24 06:19:16 2026 +0300 description: Configure: fixed clean OpenSSL builds on Windows. Calling "del" on Windows fails if the target file does not exist, so the change in 9605:146c43e035ac broke clean OpenSSL builds on Windows. The fix is to test if the file exists before trying to delete it. diffstat: auto/lib/openssl/makefile.msvc | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (13 lines): diff --git a/auto/lib/openssl/makefile.msvc b/auto/lib/openssl/makefile.msvc --- a/auto/lib/openssl/makefile.msvc +++ b/auto/lib/openssl/makefile.msvc @@ -6,7 +6,8 @@ all: cd $(OPENSSL) - del /q /f openssl\include\openssl\ssl.h + if exist openssl\include\openssl\ssl.h \ + del /q /f openssl\include\openssl\ssl.h perl Configure $(OPENSSL_TARGET) no-shared no-threads \ --prefix="%cd%/openssl" \ From mdounin at mdounin.ru Tue Nov 24 15:44:03 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:03 +0300 Subject: [nginx] HTTP/2: fixed send window refunding on stream reset. Message-ID: details: http://freenginx.org/hg/nginx/rev/db1e17bc592b branches: changeset: 9607:db1e17bc592b user: Maxim Dounin date: Tue Nov 24 06:19:18 2026 +0300 description: HTTP/2: fixed send window refunding on stream reset. Previously, if a stream was terminated, unsent frames were refunded to the connection send window and might make it larger than the allowed maximum, NGX_HTTP_V2_MAX_WINDOW. This in turn made it possible to further increase the window with additional window updates, which were accepted by ngx_http_v2_state_window_update() whenever h2c->send_window was already above NGX_HTTP_V2_MAX_WINDOW, and eventually cause off_t overflow in ngx_http_v2_send_chain(), leading to generation of buffers with negative size. This resulted in segmentation faults and other issues, including code execution on some platforms (CVE-2026-123007). The fix is to make sure that h2c->send_window is never increased above the allowed maximum, NGX_HTTP_V2_MAX_WINDOW. See also: https://github.com/nginx/nginx/commit/e27f5fa84fe6e98505e70bc543b748747dad0a3b diffstat: src/http/v2/ngx_http_v2_filter_module.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diffs (19 lines): diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c --- a/src/http/v2/ngx_http_v2_filter_module.c +++ b/src/http/v2/ngx_http_v2_filter_module.c @@ -1582,7 +1582,14 @@ ngx_http_v2_filter_cleanup(void *data) } } - h2c->send_window += window; + if (window > NGX_HTTP_V2_MAX_WINDOW + || h2c->send_window > NGX_HTTP_V2_MAX_WINDOW - window) + { + h2c->send_window = NGX_HTTP_V2_MAX_WINDOW; + + } else { + h2c->send_window += window; + } } From mdounin at mdounin.ru Tue Nov 24 15:44:03 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:03 +0300 Subject: [nginx] HTTP/2: improved window updates checking. Message-ID: details: http://freenginx.org/hg/nginx/rev/9cea9cca9fb6 branches: changeset: 9608:9cea9cca9fb6 user: Maxim Dounin date: Tue Nov 24 06:19:19 2026 +0300 description: HTTP/2: improved window updates checking. Window updates are now rejected as long as the current send window is larger than NGX_HTTP_V2_MAX_WINDOW minus the window update sent by the client, so no overflows or underflows are possible. Additionally, the check on the window update itself ensures it is no larger than the maximum (which is not possible per protocol, so the check is provided for clarity). This ensures that window updates are properly rejected even if the current send window happens to be larger than NGX_HTTP_V2_MAX_WINDOW for some reason. diffstat: src/http/v2/ngx_http_v2.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diffs (27 lines): diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -2491,8 +2491,10 @@ ngx_http_v2_state_window_update(ngx_http stream = node->stream; - if (window > (size_t) (NGX_HTTP_V2_MAX_WINDOW - stream->send_window)) { - + if (window > NGX_HTTP_V2_MAX_WINDOW + || stream->send_window + > (ssize_t) (NGX_HTTP_V2_MAX_WINDOW - window)) + { ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, "client violated flow control for stream %ui: " "received WINDOW_UPDATE frame " @@ -2529,7 +2531,9 @@ ngx_http_v2_state_window_update(ngx_http return ngx_http_v2_state_complete(h2c, pos, end); } - if (window > NGX_HTTP_V2_MAX_WINDOW - h2c->send_window) { + if (window > NGX_HTTP_V2_MAX_WINDOW + || h2c->send_window > NGX_HTTP_V2_MAX_WINDOW - window) + { ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, "client violated connection flow control: " "received WINDOW_UPDATE frame " From mdounin at mdounin.ru Tue Nov 24 15:44:03 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:03 +0300 Subject: [nginx] gRPC: improved window updates checking. Message-ID: details: http://freenginx.org/hg/nginx/rev/7575efbaf023 branches: changeset: 9609:7575efbaf023 user: Maxim Dounin date: Tue Nov 24 06:19:20 2026 +0300 description: gRPC: improved window updates checking. Following changes in HTTP/2, window updates are now rejected as long as the current send window is larger than NGX_HTTP_V2_MAX_WINDOW minus the window update sent by the client, so no overflows or underflows are possible. Additionally, the check on the window update itself ensures it is no larger than the maximum (which is not possible per protocol, so the check is provided for clarity). This ensures that window updates are properly rejected even if the current send window happens to be larger than NGX_HTTP_V2_MAX_WINDOW for some reason. diffstat: src/http/modules/ngx_http_grpc_module.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diffs (25 lines): diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c --- a/src/http/modules/ngx_http_grpc_module.c +++ b/src/http/modules/ngx_http_grpc_module.c @@ -3842,8 +3842,9 @@ ngx_http_grpc_parse_window_update(ngx_ht if (ctx->stream_id) { - if (ctx->window_update > (size_t) NGX_HTTP_V2_MAX_WINDOW - - ctx->send_window) + if (ctx->window_update > NGX_HTTP_V2_MAX_WINDOW + || ctx->send_window > (ssize_t) (NGX_HTTP_V2_MAX_WINDOW + - ctx->window_update)) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "upstream sent too large window update"); @@ -3855,7 +3856,8 @@ ngx_http_grpc_parse_window_update(ngx_ht } else { if (ctx->window_update > NGX_HTTP_V2_MAX_WINDOW - - ctx->connection->send_window) + || ctx->connection->send_window > NGX_HTTP_V2_MAX_WINDOW + - ctx->window_update) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "upstream sent too large window update"); From mdounin at mdounin.ru Tue Nov 24 15:44:03 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:03 +0300 Subject: [nginx] HTTP/2: modified ngx_http_v2_send_chain() loop to be safer. Message-ID: details: http://freenginx.org/hg/nginx/rev/3a8b0ac450ce branches: changeset: 9610:3a8b0ac450ce user: Maxim Dounin date: Tue Nov 24 06:19:22 2026 +0300 description: HTTP/2: modified ngx_http_v2_send_chain() loop to be safer. Previously, the loop used a "limit == 0" condition, and only at the end of the loop. In case of other issues, such as "limit" being negative due to h2c->send_window being large enough to overflow off_t, this resulted in incorrect buffer construction and subsequent segmentation faults or memory corruption. With the change, "limit > 0" is checked as the loop condition, and this ensures that the loop is safely terminated if "limit" ever becomes negative due to a bug, diffstat: src/http/v2/ngx_http_v2_filter_module.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diffs (23 lines): diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c --- a/src/http/v2/ngx_http_v2_filter_module.c +++ b/src/http/v2/ngx_http_v2_filter_module.c @@ -975,7 +975,7 @@ ngx_http_v2_send_chain(ngx_connection_t cl = NULL; #endif - for ( ;; ) { + while (limit > 0) { if ((off_t) frame_size > limit) { frame_size = (size_t) limit; } @@ -1070,10 +1070,6 @@ ngx_http_v2_send_chain(ngx_connection_t } limit -= frame_size; - - if (limit == 0) { - break; - } } if (offset) { From mdounin at mdounin.ru Tue Nov 24 15:44:04 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:04 +0300 Subject: [nginx] SSL: added buffer checks to ngx_ssl_send_chain(). Message-ID: details: http://freenginx.org/hg/nginx/rev/35b4f12054c8 branches: changeset: 9611:35b4f12054c8 user: Maxim Dounin date: Tue Nov 24 06:19:24 2026 +0300 description: SSL: added buffer checks to ngx_ssl_send_chain(). Similarly to buffer checks present in ngx_http_write_filter() and ngx_output_chain(), these checks are expected to catch invalid buffers if passed to the SSL layer. Notably, this is expected to improve the safety of HTTP/2, which performs complex buffer manipulations after the write filter checks. diffstat: src/event/ngx_event_openssl.c | 72 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 72 insertions(+), 0 deletions(-) diffs (89 lines): diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c @@ -3191,6 +3191,42 @@ ngx_ssl_send_chain(ngx_connection_t *c, continue; } + if (ngx_buf_size(in->buf) == 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "zero size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + + if (ngx_buf_size(in->buf) < 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "negative size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + n = ngx_ssl_write(c, in->buf->pos, in->buf->last - in->buf->pos); if (n == NGX_ERROR) { @@ -3255,6 +3291,42 @@ ngx_ssl_send_chain(ngx_connection_t *c, continue; } + if (ngx_buf_size(in->buf) == 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "zero size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + + if (ngx_buf_size(in->buf) < 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "negative size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + if (in->buf->in_file && c->ssl->sendfile) { flush = 1; break; From mdounin at mdounin.ru Tue Nov 24 15:44:04 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:04 +0300 Subject: [nginx] QUIC: avoid main connection reuse after creating a stream. Message-ID: details: http://freenginx.org/hg/nginx/rev/b53094a5b706 branches: changeset: 9613:b53094a5b706 user: Roman Arutyunyan date: Sun Nov 01 16:46:22 2026 +0400 description: QUIC: avoid main connection reuse after creating a stream. Previously, ngx_quic_create_stream() cleared the main connection's reusable flag and then called ngx_get_connection() before inserting the new stream into the tree. If the worker was low on free connections, the drain inside ngx_get_connection() could close an idle stream of the same main connection. Since the new stream was not in the tree yet, that close found no remaining streams and marked the main connection reusable again. Once reusable, the connection could later be drained while processing one of its streams, for example when connecting to an upstream, freeing it while still in use. Fix is to insert the new stream into the tree before calling ngx_get_connection(), so the main connection is not considered idle. Reported by Xint.io. Obtained from: https://github.com/nginx/nginx/commit/b5252dae1ca0d4c516b8bcffd9fa7fd967b73075 diffstat: src/event/quic/ngx_event_quic_streams.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diffs (36 lines): diff --git a/src/event/quic/ngx_event_quic_streams.c b/src/event/quic/ngx_event_quic_streams.c --- a/src/event/quic/ngx_event_quic_streams.c +++ b/src/event/quic/ngx_event_quic_streams.c @@ -723,12 +723,15 @@ ngx_quic_create_stream(ngx_connection_t addr_text.data = NULL; } + ngx_rbtree_insert(&qc->streams.tree, &qs->node); + reusable = c->reusable; ngx_reusable_connection(c, 0); sc = ngx_get_connection(c->fd, log); if (sc == NULL) { ngx_destroy_pool(pool); + ngx_rbtree_delete(&qc->streams.tree, &qs->node); ngx_queue_insert_tail(&qc->streams.free, &qs->queue); ngx_reusable_connection(c, reusable); return NULL; @@ -795,6 +798,7 @@ ngx_quic_create_stream(ngx_connection_t if (cln == NULL) { ngx_close_connection(sc); ngx_destroy_pool(pool); + ngx_rbtree_delete(&qc->streams.tree, &qs->node); ngx_queue_insert_tail(&qc->streams.free, &qs->queue); ngx_reusable_connection(c, reusable); return NULL; @@ -803,8 +807,6 @@ ngx_quic_create_stream(ngx_connection_t cln->handler = ngx_quic_stream_cleanup_handler; cln->data = sc; - ngx_rbtree_insert(&qc->streams.tree, &qs->node); - return qs; } From mdounin at mdounin.ru Tue Nov 24 15:44:04 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:04 +0300 Subject: [nginx] HTTP/2: reset reusable connection status on stream creat... Message-ID: details: http://freenginx.org/hg/nginx/rev/a0a8537a9e7b branches: changeset: 9612:a0a8537a9e7b user: Roman Arutyunyan date: Thu Sep 17 16:10:11 2026 +0400 description: HTTP/2: reset reusable connection status on stream creation. Previously, an HTTP/2 connection could be reusable while having streams. This could result in an attempt to drain the connection while processing one if its streams, for example when connecting to an upstream. After recognizing that the connection has streams, an attempt to send the GOAWAY frame was made. On send failure, the connection was immediately closed and its pool released. This triggered a use-after-free up the stack. Having an HTTP/2 connection with streams registered as reusable became possible after 76672e650. A connection with no streams and a partial frame read from client was registered as reusable to avoid DoS attacks. So if a client sends only the first HEADERS frame byte, the connection becomes reusable. Later, when the remaining HEADERS bytes are received and a new stream is created, the reusable status is not reset until the connection becomes idle. Fix is to mark the connection non-reusable upon stream creation. Reported by Albert @ Vexera AI. Obtained from: https://github.com/nginx/nginx/commit/2df48a501d0fb8212b7d39dffeeff5876332ba59 diffstat: src/http/v2/ngx_http_v2.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -3158,6 +3158,8 @@ ngx_http_v2_create_stream(ngx_http_v2_co h2c->processing++; + ngx_reusable_connection(h2c->connection, 0); + h2c->priority_limit += h2scf->concurrent_streams; if (h2c->connection->read->timer_set) { From mdounin at mdounin.ru Tue Nov 24 15:44:04 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:04 +0300 Subject: [nginx] Resolver: reworked ctx->handler calls. Message-ID: details: http://freenginx.org/hg/nginx/rev/f441c668e499 branches: changeset: 9615:f441c668e499 user: Maxim Dounin date: Tue Nov 24 06:19:57 2026 +0300 description: Resolver: reworked ctx->handler calls. Previously, all resolver contexts were detached from the rn->waiting list when reporting resolution results via corresponding ctx->handler() calls. And if a handler call caused another resolver context on the same list to be freed via the ngx_resolver_name_done() or ngx_resolve_addr_done() call, as can happen with subrequests, this resulted in "could not cancel ... resolving" alerts and then use-after-free when ctx->handler() was subsequently called for the freed context (CVE-2026-123634, though security impact is questionable). The fix is to keep all contexts linked to rn->waiting and detach them one by one, so the contexts which are freed elsewhere are removed from the list. See also: https://github.com/nginx/nginx/commit/e39708edc69a9c0c992b6af075db761946969534 diffstat: src/core/ngx_resolver.c | 214 ++++++++++++++++++++--------------------------- 1 files changed, 92 insertions(+), 122 deletions(-) diffs (482 lines): diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c --- a/src/core/ngx_resolver.c +++ b/src/core/ngx_resolver.c @@ -112,6 +112,8 @@ static void *ngx_resolver_calloc(ngx_res static void ngx_resolver_free(ngx_resolver_t *r, void *p); static void ngx_resolver_free_locked(ngx_resolver_t *r, void *p); static void *ngx_resolver_dup(ngx_resolver_t *r, void *src, size_t size); +static void ngx_resolver_link_waiting(ngx_resolver_t *r, + ngx_resolver_node_t *rn, ngx_resolver_ctx_t *ctx); static ngx_resolver_addr_t *ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn, ngx_uint_t rotate); static void ngx_resolver_report_srv(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx); @@ -612,7 +614,6 @@ ngx_resolve_name_locked(ngx_resolver_t * ngx_uint_t i, naddrs; ngx_queue_t *resend_queue, *expire_queue; ngx_rbtree_t *tree; - ngx_resolver_ctx_t *next, *last; ngx_resolver_addr_t *addrs; ngx_resolver_node_t *rn; @@ -637,9 +638,6 @@ ngx_resolve_name_locked(ngx_resolver_t * if (rn) { - /* ctx can be a list after NGX_RESOLVE_CNAME */ - for (last = ctx; last->next; last = last->next); - if (rn->valid >= ngx_time()) { ngx_log_debug0(NGX_LOG_DEBUG_CORE, r->log, 0, "resolve cached"); @@ -667,12 +665,12 @@ ngx_resolve_name_locked(ngx_resolver_t * } } - last->next = rn->waiting; - rn->waiting = NULL; - - /* unlock name mutex */ - - do { + ngx_resolver_link_waiting(r, rn, ctx); + + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = NGX_OK; ctx->valid = rn->valid; ctx->naddrs = naddrs; @@ -689,12 +687,8 @@ ngx_resolve_name_locked(ngx_resolver_t * ctx->addrs = addrs; } - next = ctx->next; - ctx->handler(ctx); - - ctx = next; - } while (ctx); + } if (addrs != NULL) { ngx_resolver_free(r, addrs->sockaddr); @@ -705,18 +699,14 @@ ngx_resolve_name_locked(ngx_resolver_t * } if (rn->nsrvs) { - last->next = rn->waiting; - rn->waiting = NULL; - - /* unlock name mutex */ - - do { - next = ctx->next; + ngx_resolver_link_waiting(r, rn, ctx); + + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; ngx_resolver_resolve_srv_names(ctx, rn); - - ctx = next; - } while (ctx); + } return NGX_OK; } @@ -731,20 +721,17 @@ ngx_resolve_name_locked(ngx_resolver_t * return ngx_resolve_name_locked(r, ctx, &cname); } - last->next = rn->waiting; - rn->waiting = NULL; - - /* unlock name mutex */ - - do { + ngx_resolver_link_waiting(r, rn, ctx); + + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = NGX_RESOLVE_NXDOMAIN; ctx->valid = ngx_time() + (r->valid ? r->valid : 10); - next = ctx->next; ctx->handler(ctx); - - ctx = next; - } while (ctx); + } return NGX_OK; } @@ -754,16 +741,11 @@ ngx_resolve_name_locked(ngx_resolver_t * return NGX_ERROR; } - last->next = rn->waiting; - rn->waiting = ctx; + ngx_resolver_link_waiting(r, rn, ctx); + ctx->state = NGX_AGAIN; ctx->async = 1; - do { - ctx->node = rn; - ctx = ctx->next; - } while (ctx); - return NGX_AGAIN; } @@ -824,6 +806,7 @@ ngx_resolve_name_locked(ngx_resolver_t * #if (NGX_HAVE_INET6) rn->query6 = NULL; #endif + rn->waiting = NULL; ngx_rbtree_insert(tree, &rn->node); } @@ -842,19 +825,21 @@ ngx_resolve_name_locked(ngx_resolver_t * if (rc == NGX_DECLINED) { ngx_rbtree_delete(tree, &rn->node); + ngx_resolver_link_waiting(r, rn, ctx); + + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + + ctx->state = NGX_RESOLVE_NXDOMAIN; + + ctx->handler(ctx); + } + ngx_resolver_free(r, rn->query); ngx_resolver_free(r, rn->name); ngx_resolver_free(r, rn); - do { - ctx->state = NGX_RESOLVE_NXDOMAIN; - next = ctx->next; - - ctx->handler(ctx); - - ctx = next; - } while (ctx); - return NGX_OK; } @@ -899,16 +884,12 @@ ngx_resolve_name_locked(ngx_resolver_t * rn->cnlen = 0; rn->valid = 0; rn->ttl = NGX_MAX_UINT32_VALUE; - rn->waiting = ctx; + + ngx_resolver_link_waiting(r, rn, ctx); ctx->state = NGX_AGAIN; ctx->async = 1; - do { - ctx->node = rn; - ctx = ctx->next; - } while (ctx); - return NGX_AGAIN; failed: @@ -1021,11 +1002,10 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx return NGX_ERROR; } - ctx->next = rn->waiting; - rn->waiting = ctx; + ngx_resolver_link_waiting(r, rn, ctx); + ctx->state = NGX_AGAIN; ctx->async = 1; - ctx->node = rn; /* unlock addr mutex */ @@ -1063,6 +1043,7 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx #if (NGX_HAVE_INET6) rn->query6 = NULL; #endif + rn->waiting = NULL; ngx_rbtree_insert(tree, &rn->node); } @@ -1114,13 +1095,13 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx rn->nlen = 0; rn->valid = 0; rn->ttl = NGX_MAX_UINT32_VALUE; - rn->waiting = ctx; + + ngx_resolver_link_waiting(r, rn, ctx); /* unlock addr mutex */ ctx->state = NGX_AGAIN; ctx->async = 1; - ctx->node = rn; return NGX_OK; @@ -2128,20 +2109,16 @@ ngx_resolver_process_a(ngx_resolver_t *r } #endif - next = rn->waiting; - rn->waiting = NULL; - ngx_queue_remove(&rn->queue); ngx_rbtree_delete(&r->name_rbtree, &rn->node); - /* unlock name mutex */ - - while (next) { - ctx = next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = code; ctx->valid = ngx_time() + (r->valid ? r->valid : 10); - next = ctx->next; ctx->handler(ctx); } @@ -2447,13 +2424,10 @@ ngx_resolver_process_a(ngx_resolver_t *r ngx_queue_insert_head(&r->name_expire_queue, &rn->queue); - next = rn->waiting; - rn->waiting = NULL; - - /* unlock name mutex */ - - while (next) { - ctx = next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = NGX_OK; ctx->valid = rn->valid; ctx->naddrs = naddrs; @@ -2470,8 +2444,6 @@ ngx_resolver_process_a(ngx_resolver_t *r ctx->addrs = addrs; } - next = ctx->next; - ctx->handler(ctx); } @@ -2526,26 +2498,25 @@ ngx_resolver_process_a(ngx_resolver_t *r #endif ctx = rn->waiting; - rn->waiting = NULL; if (ctx) { if (ctx->recursion++ >= NGX_RESOLVER_MAX_RECURSION) { - /* unlock name mutex */ - do { ctx->state = NGX_RESOLVE_NXDOMAIN; - next = ctx->next; + rn->waiting = ctx->next; ctx->handler(ctx); - ctx = next; + ctx = rn->waiting; } while (ctx); return; } + rn->waiting = NULL; + for (next = ctx; next; next = next->next) { next->node = NULL; } @@ -2553,8 +2524,6 @@ ngx_resolver_process_a(ngx_resolver_t *r (void) ngx_resolve_name_locked(r, ctx, &name); } - /* unlock name mutex */ - return; } @@ -2672,18 +2641,16 @@ ngx_resolver_process_srv(ngx_resolver_t } if (code) { - next = rn->waiting; - rn->waiting = NULL; - ngx_queue_remove(&rn->queue); ngx_rbtree_delete(&r->srv_rbtree, &rn->node); - while (next) { - ctx = next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = code; ctx->valid = ngx_time() + (r->valid ? r->valid : 10); - next = ctx->next; ctx->handler(ctx); } @@ -2868,12 +2835,9 @@ ngx_resolver_process_srv(ngx_resolver_t ngx_queue_insert_head(&r->srv_expire_queue, &rn->queue); - next = rn->waiting; - rn->waiting = NULL; - - while (next) { - ctx = next; - next = ctx->next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; ngx_resolver_resolve_srv_names(ctx, rn); } @@ -2911,26 +2875,25 @@ ngx_resolver_process_srv(ngx_resolver_t #endif ctx = rn->waiting; - rn->waiting = NULL; if (ctx) { if (ctx->recursion++ >= NGX_RESOLVER_MAX_RECURSION) { - /* unlock name mutex */ - do { ctx->state = NGX_RESOLVE_NXDOMAIN; - next = ctx->next; + rn->waiting = ctx->next; ctx->handler(ctx); - ctx = next; + ctx = rn->waiting; } while (ctx); return; } + rn->waiting = NULL; + for (next = ctx; next; next = next->next) { next->node = NULL; } @@ -2938,8 +2901,6 @@ ngx_resolver_process_srv(ngx_resolver_t (void) ngx_resolve_name_locked(r, ctx, &name); } - /* unlock name mutex */ - return; } @@ -3112,7 +3073,7 @@ ngx_resolver_process_ptr(ngx_resolver_t ngx_queue_t *expire_queue; ngx_rbtree_t *tree; ngx_resolver_an_t *an; - ngx_resolver_ctx_t *ctx, *next; + ngx_resolver_ctx_t *ctx; ngx_resolver_node_t *rn; #if (NGX_HAVE_INET6) uint32_t hash; @@ -3237,20 +3198,16 @@ valid: } if (code) { - next = rn->waiting; - rn->waiting = NULL; - ngx_queue_remove(&rn->queue); ngx_rbtree_delete(tree, &rn->node); - /* unlock addr mutex */ - - while (next) { - ctx = next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = code; ctx->valid = ngx_time() + (r->valid ? r->valid : 10); - next = ctx->next; ctx->handler(ctx); } @@ -3376,17 +3333,13 @@ ptr: ngx_queue_insert_head(expire_queue, &rn->queue); - next = rn->waiting; - rn->waiting = NULL; - - /* unlock addr mutex */ - - while (next) { - ctx = next; + while (rn->waiting) { + ctx = rn->waiting; + rn->waiting = ctx->next; + ctx->state = NGX_OK; ctx->valid = rn->valid; ctx->name = name; - next = ctx->next; ctx->handler(ctx); } @@ -4216,6 +4169,23 @@ ngx_resolver_dup(ngx_resolver_t *r, void } +static void +ngx_resolver_link_waiting(ngx_resolver_t *r, ngx_resolver_node_t *rn, + ngx_resolver_ctx_t *ctx) +{ + ngx_resolver_ctx_t *last; + + for (last = ctx; last->next; last = last->next) { + last->node = rn; + } + + last->node = rn; + last->next = rn->waiting; + + rn->waiting = ctx; +} + + static ngx_resolver_addr_t * ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn, ngx_uint_t rotate) From mdounin at mdounin.ru Tue Nov 24 15:44:04 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:04 +0300 Subject: [nginx] Mail: blocked client write events during various operati... Message-ID: details: http://freenginx.org/hg/nginx/rev/978828dc81f0 branches: changeset: 9614:978828dc81f0 user: Maxim Dounin date: Tue Nov 24 06:19:51 2026 +0300 description: Mail: blocked client write events during various operations. Previously, only read events were blocked during various operations, notably during auth_http requests, connecting to upstream servers, and DNS resolution in SMTP. With ngx_mail_send() as a write event handler, this might result in use-after-free if ngx_mail_send() is called due to a write event and closes the session due to an error, while an ongoing operation, such as an auth_http request, still references it (CVE-2026-113425). The fix is to block write events similarly to how read events are currently blocked during corresponding operations. See also: https://github.com/nginx/nginx/commit/df9d8d940ecb83a50b1e55ccc296d0a29cfe774c https://github.com/nginx/nginx/commit/e2d23d45fa93ed236a9cdedcb54271e0a064c4f3 https://github.com/nginx/nginx/commit/5deda780a9d5d1bcd5c6731d3118fa090ae900cc https://github.com/nginx/nginx/commit/4c5ace9f1d5419334a2e6772a0885ee7ed3d6e91 diffstat: src/mail/ngx_mail_auth_http_module.c | 27 +++++++++++++++++++++++++++ src/mail/ngx_mail_proxy_module.c | 19 +++++++++++++++++++ src/mail/ngx_mail_smtp_handler.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 0 deletions(-) diffs (175 lines): diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c --- a/src/mail/ngx_mail_auth_http_module.c +++ b/src/mail/ngx_mail_auth_http_module.c @@ -74,6 +74,7 @@ static void ngx_mail_auth_send_error(ngx static ngx_int_t ngx_mail_auth_http_parse_header_line(ngx_mail_session_t *s, ngx_mail_auth_http_ctx_t *ctx); static void ngx_mail_auth_http_block_read(ngx_event_t *rev); +static void ngx_mail_auth_http_block_write(ngx_event_t *wev); static void ngx_mail_auth_http_dummy_handler(ngx_event_t *ev); static ngx_buf_t *ngx_mail_auth_http_create_request(ngx_mail_session_t *s, ngx_pool_t *pool, ngx_mail_auth_http_conf_t *ahcf); @@ -231,6 +232,7 @@ ngx_mail_auth_http_init(ngx_mail_session ctx->peer.connection->pool = s->connection->pool; s->connection->read->handler = ngx_mail_auth_http_block_read; + s->connection->write->handler = ngx_mail_auth_http_block_write; ctx->peer.connection->read->handler = ngx_mail_auth_http_read_handler; ctx->peer.connection->write->handler = ngx_mail_auth_http_write_handler; @@ -783,6 +785,8 @@ ngx_mail_auth_http_process_headers(ngx_m ngx_close_connection(ctx->peer.connection); + s->connection->write->handler = ngx_mail_send; + if (ctx->err.len) { ngx_log_error(NGX_LOG_INFO, s->connection->log, 0, @@ -1254,6 +1258,29 @@ ngx_mail_auth_http_block_read(ngx_event_ static void +ngx_mail_auth_http_block_write(ngx_event_t *wev) +{ + ngx_connection_t *c; + ngx_mail_session_t *s; + ngx_mail_auth_http_ctx_t *ctx; + + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, + "mail auth http block write"); + + if (ngx_handle_write_event(wev, 0) != NGX_OK) { + c = wev->data; + s = c->data; + + ctx = ngx_mail_get_module_ctx(s, ngx_mail_auth_http_module); + + ngx_close_connection(ctx->peer.connection); + ngx_destroy_pool(ctx->pool); + ngx_mail_session_internal_server_error(s); + } +} + + +static void ngx_mail_auth_http_dummy_handler(ngx_event_t *ev) { ngx_log_debug0(NGX_LOG_DEBUG_MAIL, ev->log, 0, diff --git a/src/mail/ngx_mail_proxy_module.c b/src/mail/ngx_mail_proxy_module.c --- a/src/mail/ngx_mail_proxy_module.c +++ b/src/mail/ngx_mail_proxy_module.c @@ -24,6 +24,7 @@ typedef struct { static void ngx_mail_proxy_block_read(ngx_event_t *rev); +static void ngx_mail_proxy_block_write(ngx_event_t *wev); static void ngx_mail_proxy_pop3_handler(ngx_event_t *rev); static void ngx_mail_proxy_imap_handler(ngx_event_t *rev); static void ngx_mail_proxy_smtp_handler(ngx_event_t *rev); @@ -165,6 +166,7 @@ ngx_mail_proxy_init(ngx_mail_session_t * p->upstream.connection->pool = s->connection->pool; s->connection->read->handler = ngx_mail_proxy_block_read; + s->connection->write->handler = ngx_mail_proxy_block_write; p->upstream.connection->write->handler = ngx_mail_proxy_write_handler; pcf = ngx_mail_get_module_srv_conf(s, ngx_mail_proxy_module); @@ -224,6 +226,23 @@ ngx_mail_proxy_block_read(ngx_event_t *r static void +ngx_mail_proxy_block_write(ngx_event_t *wev) +{ + ngx_connection_t *c; + ngx_mail_session_t *s; + + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, "mail proxy block write"); + + if (ngx_handle_read_event(wev, 0) != NGX_OK) { + c = wev->data; + s = c->data; + + ngx_mail_proxy_close_session(s); + } +} + + +static void ngx_mail_proxy_pop3_handler(ngx_event_t *rev) { u_char *p; diff --git a/src/mail/ngx_mail_smtp_handler.c b/src/mail/ngx_mail_smtp_handler.c --- a/src/mail/ngx_mail_smtp_handler.c +++ b/src/mail/ngx_mail_smtp_handler.c @@ -16,6 +16,7 @@ static void ngx_mail_smtp_resolve_addr_h static void ngx_mail_smtp_resolve_name(ngx_event_t *rev); static void ngx_mail_smtp_resolve_name_handler(ngx_resolver_ctx_t *ctx); static void ngx_mail_smtp_block_reading(ngx_event_t *rev); +static void ngx_mail_smtp_block_writing(ngx_event_t *wev); static void ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c); static void ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev); static ngx_int_t ngx_mail_smtp_create_buffer(ngx_mail_session_t *s, @@ -91,6 +92,7 @@ ngx_mail_smtp_init_session(ngx_mail_sess s->resolver_ctx = ctx; c->read->handler = ngx_mail_smtp_block_reading; + c->write->handler = ngx_mail_smtp_block_writing; if (ngx_resolve_addr(ctx) != NGX_OK) { ngx_mail_close_connection(c); @@ -278,6 +280,38 @@ ngx_mail_smtp_block_reading(ngx_event_t static void +ngx_mail_smtp_block_writing(ngx_event_t *wev) +{ + ngx_connection_t *c; + ngx_mail_session_t *s; + ngx_resolver_ctx_t *ctx; + + c = wev->data; + s = c->data; + + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, c->log, 0, "smtp writing blocked"); + + if (ngx_handle_write_event(wev, 0) != NGX_OK) { + + if (s->resolver_ctx) { + ctx = s->resolver_ctx; + + if (ctx->handler == ngx_mail_smtp_resolve_addr_handler) { + ngx_resolve_addr_done(ctx); + + } else if (ctx->handler == ngx_mail_smtp_resolve_name_handler) { + ngx_resolve_name_done(ctx); + } + + s->resolver_ctx = NULL; + } + + ngx_mail_close_connection(c); + } +} + + +static void ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c) { ngx_msec_t timeout; @@ -307,6 +341,7 @@ ngx_mail_smtp_greeting(ngx_mail_session_ } c->read->handler = ngx_mail_smtp_init_protocol; + c->write->handler = ngx_mail_send; s->out = sscf->greeting; @@ -336,6 +371,7 @@ ngx_mail_smtp_invalid_pipelining(ngx_eve cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module); c->read->handler = ngx_mail_smtp_init_protocol; + c->write->handler = ngx_mail_send; ngx_add_timer(c->read, cscf->timeout); From mdounin at mdounin.ru Tue Nov 24 15:44:04 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:04 +0300 Subject: [nginx] Disabled repeated posts of write events without progress. Message-ID: details: http://freenginx.org/hg/nginx/rev/f8ba4ceb0c9a branches: changeset: 9616:f8ba4ceb0c9a user: Maxim Dounin date: Tue Nov 24 06:20:24 2026 +0300 description: Disabled repeated posts of write events without progress. Previously, since 7947:51a260276425 in write filter and 7949:862f6130d357 in output chain, write events were posted for the next event loop operation if there were unsent data and the connection was still ready for writing. However, with SSL the c->write->ready flag might still be set when writing isn't possible, such as when SSL_write() returns SSL_ERROR_WANT_READ (which might be the case during a handshake when responding to early data, or during renegotiation with an upstream server). This could cause some excessive CPU usage until the timeout expires (known as CVE-2026-132779, though security impact in freenginx is questionable). The fix is to post write events only if some progress was made, similarly to how we rearm write timeouts (9358:4c872940b19b). See also: https://github.com/nginx/nginx/commit/2c84628229bdeedd16db5980af6e8fdf754cc80d https://github.com/nginx/nginx/commit/a12a232e6472b39a53b5e31266846843e142950d diffstat: src/core/ngx_output_chain.c | 6 ++++-- src/http/ngx_http_write_filter_module.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diffs (42 lines): diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c --- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -658,7 +658,7 @@ ngx_chain_writer(void *data, ngx_chain_t { ngx_chain_writer_ctx_t *ctx = data; - off_t size; + off_t size, sent; ngx_chain_t *cl, *ln, *chain; ngx_connection_t *c; @@ -775,6 +775,8 @@ ngx_chain_writer(void *data, ngx_chain_t return NGX_OK; } + sent = c->sent; + chain = c->send_chain(c, ctx->out, ctx->limit); ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0, @@ -784,7 +786,7 @@ ngx_chain_writer(void *data, ngx_chain_t return NGX_ERROR; } - if (chain && c->write->ready) { + if (chain && c->write->ready && c->sent != sent) { ngx_post_event(c->write, &ngx_posted_next_events); } diff --git a/src/http/ngx_http_write_filter_module.c b/src/http/ngx_http_write_filter_module.c --- a/src/http/ngx_http_write_filter_module.c +++ b/src/http/ngx_http_write_filter_module.c @@ -336,7 +336,7 @@ ngx_http_write_filter(ngx_http_request_t } } - if (chain && c->write->ready && !c->write->delayed) { + if (chain && c->write->ready && !c->write->delayed && c->sent != sent) { ngx_post_event(c->write, &ngx_posted_next_events); } From mdounin at mdounin.ru Tue Nov 24 15:44:04 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:04 +0300 Subject: [nginx] Updated zlib used for win32 builds. Message-ID: details: http://freenginx.org/hg/nginx/rev/ef1c52e9e9d0 branches: changeset: 9617:ef1c52e9e9d0 user: Maxim Dounin date: Tue Nov 24 06:20:51 2026 +0300 description: Updated zlib used for win32 builds. diffstat: misc/GNUmakefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff --git a/misc/GNUmakefile b/misc/GNUmakefile --- a/misc/GNUmakefile +++ b/misc/GNUmakefile @@ -7,7 +7,7 @@ TEMP = tmp CC = cl OBJS = objs.msvc8 OPENSSL = openssl-3.5.9 -ZLIB = zlib-1.3.2 +ZLIB = zlib-1.4 PCRE = pcre2-10.49 From mdounin at mdounin.ru Tue Nov 24 15:44:04 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:04 +0300 Subject: [nginx] Fixed typo. Message-ID: details: http://freenginx.org/hg/nginx/rev/bd829db9f30a branches: changeset: 9618:bd829db9f30a user: Maxim Dounin date: Tue Nov 24 16:39:35 2026 +0300 description: Fixed typo. diffstat: docs/xml/nginx/changes.xml | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml --- a/docs/xml/nginx/changes.xml +++ b/docs/xml/nginx/changes.xml @@ -20,7 +20,7 @@ one of the keys was left uninitialized when using automatic rotation of TLS session ticket keys, making it possible to forge a session -and bypass client certificate verification (CVE-2026-97629); +and bypass client certificate verification (CVE-2026-97629). From mdounin at mdounin.ru Tue Nov 24 15:44:05 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:05 +0300 Subject: [nginx] release-1.31.6 tag Message-ID: details: http://freenginx.org/hg/nginx/rev/372f3bb3258b branches: changeset: 9620:372f3bb3258b user: Maxim Dounin date: Tue Nov 24 17:05:39 2026 +0300 description: release-1.31.6 tag diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -499,3 +499,4 @@ e3c5f3106d3837629514c0f5cb9aac189c07e432 47e34b225e5f13ceacadba8a37e27ce9a299b2fb release-1.31.3 eb9af667479439edb90b77efcb90e9e41bbec75f release-1.31.4 3c2243e864752f550d8cf81cc346505ca46b10c3 release-1.31.5 +7a6fd5834f269275d62d401acd62cf28175174a8 release-1.31.6 From mdounin at mdounin.ru Tue Nov 24 15:44:05 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:05 +0300 Subject: [nginx] freenginx-1.31.6-RELEASE Message-ID: details: http://freenginx.org/hg/nginx/rev/7a6fd5834f26 branches: changeset: 9619:7a6fd5834f26 user: Maxim Dounin date: Tue Nov 24 17:05:38 2026 +0300 description: freenginx-1.31.6-RELEASE diffstat: docs/xml/nginx/changes.xml | 102 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 102 insertions(+), 0 deletions(-) diffs (112 lines): diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml --- a/docs/xml/nginx/changes.xml +++ b/docs/xml/nginx/changes.xml @@ -7,6 +7,108 @@
+ + + + +??? ????????????? HTTP/2 +???????????? ???? ?????????? ??????? +????? ??????? ??????????? ?????? ???????? ????????, +??? ???????????? ????? ????????? ? ?????????? ????????????? ???? +(CVE-2026-123007). + + +a flow control window overflow +might cause memory corruption in a worker process +when using HTTP/2, +potentially resulting in arbitrary code execution +(CVE-2026-123007). + + + + + +??? ????????????? HTTP/2 +????? ??????????? ????????? ? ????? ????????????? ??????, +??? ???????????? ????? ????????? ? ?????????? ????????????? ???? +(CVE-2026-123633). + + +use-after-free might occur +when using HTTP/2, +potentially resulting in arbitrary code execution +(CVE-2026-123633). + + + + + +??? ????????????? HTTP/3 +????? ??????????? ????????? ? ????? ????????????? ??????, +??? ???????????? ????? ????????? ? ?????????? ????????????? ???? +(CVE-2026-121810). + + +use-after-free might occur +when using HTTP/3, +potentially resulting in arbitrary code execution +(CVE-2026-121810). + + + + + +??? ????????????? ????????? ??????-??????? +????? ??????????? ????????? ? ????? ????????????? ??????, +??? ???????????? ????? ????????? ? ?????????? ????????????? ???? +(CVE-2026-113425). + + +use-after-free might occur +when using the mail proxy module, +potentially resulting in arbitrary code execution +(CVE-2026-113425). + + + + + +??? ????????????? ????????? resolver ? ??????????? +? ??????? ???????? ??? ????????? segmentation fault. + + +a segmentation fault might occur in a worker process +if the "resolver" directive was used in subrequests. + + + + + +??? ????????????? ????????? ssl_early_data +????? ??????????? ?????????? ??????????? ???????? ??????????. + + +excessive CPU usage might be observed +when using the "ssl_early_data" directive. + + + + + +??? ????????????? ????????? --with-openssl ??? ?????? OpenSSL 4.1 +????? ?????????? ??????????? ????????? ?????? OpenSSL.
+??????? nisbet-hubbard. +
+ +OpenSSL might be rebuilt unexpectedly +when using the --with-openssl option to build OpenSSL 4.1.
+Thanks to nisbet-hubbard. +
+
+ +
+ + From mdounin at mdounin.ru Tue Nov 24 15:44:35 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:35 +0300 Subject: [nginx] Version bump. Message-ID: details: http://freenginx.org/hg/nginx/rev/98eee5438ea2 branches: stable-1.30 changeset: 9621:98eee5438ea2 user: Maxim Dounin date: Tue Nov 24 17:07:21 2026 +0300 description: Version bump. diffstat: src/core/nginx.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff --git a/src/core/nginx.h b/src/core/nginx.h --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -9,8 +9,8 @@ #define _NGINX_H_INCLUDED_ -#define nginx_version 1030002 -#define NGINX_VERSION "1.30.2" +#define nginx_version 1030003 +#define NGINX_VERSION "1.30.3" #define freenginx 1 From mdounin at mdounin.ru Tue Nov 24 15:44:35 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:35 +0300 Subject: [nginx] HTTP/2: fixed send window refunding on stream reset. Message-ID: details: http://freenginx.org/hg/nginx/rev/382119690f9a branches: stable-1.30 changeset: 9622:382119690f9a user: Maxim Dounin date: Tue Nov 24 06:19:18 2026 +0300 description: HTTP/2: fixed send window refunding on stream reset. Previously, if a stream was terminated, unsent frames were refunded to the connection send window and might make it larger than the allowed maximum, NGX_HTTP_V2_MAX_WINDOW. This in turn made it possible to further increase the window with additional window updates, which were accepted by ngx_http_v2_state_window_update() whenever h2c->send_window was already above NGX_HTTP_V2_MAX_WINDOW, and eventually cause off_t overflow in ngx_http_v2_send_chain(), leading to generation of buffers with negative size. This resulted in segmentation faults and other issues, including code execution on some platforms (CVE-2026-123007). The fix is to make sure that h2c->send_window is never increased above the allowed maximum, NGX_HTTP_V2_MAX_WINDOW. See also: https://github.com/nginx/nginx/commit/e27f5fa84fe6e98505e70bc543b748747dad0a3b diffstat: src/http/v2/ngx_http_v2_filter_module.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diffs (19 lines): diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c --- a/src/http/v2/ngx_http_v2_filter_module.c +++ b/src/http/v2/ngx_http_v2_filter_module.c @@ -1565,7 +1565,14 @@ ngx_http_v2_filter_cleanup(void *data) } } - h2c->send_window += window; + if (window > NGX_HTTP_V2_MAX_WINDOW + || h2c->send_window > NGX_HTTP_V2_MAX_WINDOW - window) + { + h2c->send_window = NGX_HTTP_V2_MAX_WINDOW; + + } else { + h2c->send_window += window; + } } From mdounin at mdounin.ru Tue Nov 24 15:44:35 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:35 +0300 Subject: [nginx] HTTP/2: improved window updates checking. Message-ID: details: http://freenginx.org/hg/nginx/rev/7227e48681f7 branches: stable-1.30 changeset: 9623:7227e48681f7 user: Maxim Dounin date: Tue Nov 24 06:19:19 2026 +0300 description: HTTP/2: improved window updates checking. Window updates are now rejected as long as the current send window is larger than NGX_HTTP_V2_MAX_WINDOW minus the window update sent by the client, so no overflows or underflows are possible. Additionally, the check on the window update itself ensures it is no larger than the maximum (which is not possible per protocol, so the check is provided for clarity). This ensures that window updates are properly rejected even if the current send window happens to be larger than NGX_HTTP_V2_MAX_WINDOW for some reason. diffstat: src/http/v2/ngx_http_v2.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diffs (27 lines): diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -2491,8 +2491,10 @@ ngx_http_v2_state_window_update(ngx_http stream = node->stream; - if (window > (size_t) (NGX_HTTP_V2_MAX_WINDOW - stream->send_window)) { - + if (window > NGX_HTTP_V2_MAX_WINDOW + || stream->send_window + > (ssize_t) (NGX_HTTP_V2_MAX_WINDOW - window)) + { ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, "client violated flow control for stream %ui: " "received WINDOW_UPDATE frame " @@ -2529,7 +2531,9 @@ ngx_http_v2_state_window_update(ngx_http return ngx_http_v2_state_complete(h2c, pos, end); } - if (window > NGX_HTTP_V2_MAX_WINDOW - h2c->send_window) { + if (window > NGX_HTTP_V2_MAX_WINDOW + || h2c->send_window > NGX_HTTP_V2_MAX_WINDOW - window) + { ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, "client violated connection flow control: " "received WINDOW_UPDATE frame " From mdounin at mdounin.ru Tue Nov 24 15:44:35 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:35 +0300 Subject: [nginx] gRPC: improved window updates checking. Message-ID: details: http://freenginx.org/hg/nginx/rev/0a8d0b2aae20 branches: stable-1.30 changeset: 9624:0a8d0b2aae20 user: Maxim Dounin date: Tue Nov 24 06:19:20 2026 +0300 description: gRPC: improved window updates checking. Following changes in HTTP/2, window updates are now rejected as long as the current send window is larger than NGX_HTTP_V2_MAX_WINDOW minus the window update sent by the client, so no overflows or underflows are possible. Additionally, the check on the window update itself ensures it is no larger than the maximum (which is not possible per protocol, so the check is provided for clarity). This ensures that window updates are properly rejected even if the current send window happens to be larger than NGX_HTTP_V2_MAX_WINDOW for some reason. diffstat: src/http/modules/ngx_http_grpc_module.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diffs (25 lines): diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c --- a/src/http/modules/ngx_http_grpc_module.c +++ b/src/http/modules/ngx_http_grpc_module.c @@ -3729,8 +3729,9 @@ ngx_http_grpc_parse_window_update(ngx_ht if (ctx->stream_id) { - if (ctx->window_update > (size_t) NGX_HTTP_V2_MAX_WINDOW - - ctx->send_window) + if (ctx->window_update > NGX_HTTP_V2_MAX_WINDOW + || ctx->send_window > (ssize_t) (NGX_HTTP_V2_MAX_WINDOW + - ctx->window_update)) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "upstream sent too large window update"); @@ -3742,7 +3743,8 @@ ngx_http_grpc_parse_window_update(ngx_ht } else { if (ctx->window_update > NGX_HTTP_V2_MAX_WINDOW - - ctx->connection->send_window) + || ctx->connection->send_window > NGX_HTTP_V2_MAX_WINDOW + - ctx->window_update) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "upstream sent too large window update"); From mdounin at mdounin.ru Tue Nov 24 15:44:35 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:35 +0300 Subject: [nginx] HTTP/2: modified ngx_http_v2_send_chain() loop to be safer. Message-ID: details: http://freenginx.org/hg/nginx/rev/cffef4d7dc36 branches: stable-1.30 changeset: 9625:cffef4d7dc36 user: Maxim Dounin date: Tue Nov 24 06:19:22 2026 +0300 description: HTTP/2: modified ngx_http_v2_send_chain() loop to be safer. Previously, the loop used a "limit == 0" condition, and only at the end of the loop. In case of other issues, such as "limit" being negative due to h2c->send_window being large enough to overflow off_t, this resulted in incorrect buffer construction and subsequent segmentation faults or memory corruption. With the change, "limit > 0" is checked as the loop condition, and this ensures that the loop is safely terminated if "limit" ever becomes negative due to a bug, diffstat: src/http/v2/ngx_http_v2_filter_module.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diffs (23 lines): diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c --- a/src/http/v2/ngx_http_v2_filter_module.c +++ b/src/http/v2/ngx_http_v2_filter_module.c @@ -958,7 +958,7 @@ ngx_http_v2_send_chain(ngx_connection_t cl = NULL; #endif - for ( ;; ) { + while (limit > 0) { if ((off_t) frame_size > limit) { frame_size = (size_t) limit; } @@ -1053,10 +1053,6 @@ ngx_http_v2_send_chain(ngx_connection_t } limit -= frame_size; - - if (limit == 0) { - break; - } } if (offset) { From mdounin at mdounin.ru Tue Nov 24 15:44:35 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:35 +0300 Subject: [nginx] SSL: added buffer checks to ngx_ssl_send_chain(). Message-ID: details: http://freenginx.org/hg/nginx/rev/fdf64352e509 branches: stable-1.30 changeset: 9626:fdf64352e509 user: Maxim Dounin date: Tue Nov 24 06:19:24 2026 +0300 description: SSL: added buffer checks to ngx_ssl_send_chain(). Similarly to buffer checks present in ngx_http_write_filter() and ngx_output_chain(), these checks are expected to catch invalid buffers if passed to the SSL layer. Notably, this is expected to improve the safety of HTTP/2, which performs complex buffer manipulations after the write filter checks. diffstat: src/event/ngx_event_openssl.c | 72 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 72 insertions(+), 0 deletions(-) diffs (89 lines): diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c @@ -3191,6 +3191,42 @@ ngx_ssl_send_chain(ngx_connection_t *c, continue; } + if (ngx_buf_size(in->buf) == 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "zero size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + + if (ngx_buf_size(in->buf) < 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "negative size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + n = ngx_ssl_write(c, in->buf->pos, in->buf->last - in->buf->pos); if (n == NGX_ERROR) { @@ -3255,6 +3291,42 @@ ngx_ssl_send_chain(ngx_connection_t *c, continue; } + if (ngx_buf_size(in->buf) == 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "zero size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + + if (ngx_buf_size(in->buf) < 0) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "negative size buf in ssl send chain " + "t:%d r:%d f:%d %p %p-%p %p %O-%O", + in->buf->temporary, + in->buf->recycled, + in->buf->in_file, + in->buf->start, + in->buf->pos, + in->buf->last, + in->buf->file, + in->buf->file_pos, + in->buf->file_last); + + ngx_debug_point(); + return NGX_CHAIN_ERROR; + } + if (in->buf->in_file && c->ssl->sendfile) { flush = 1; break; From mdounin at mdounin.ru Tue Nov 24 15:44:36 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:36 +0300 Subject: [nginx] HTTP/2: reset reusable connection status on stream creat... Message-ID: details: http://freenginx.org/hg/nginx/rev/cc1dc02d047c branches: stable-1.30 changeset: 9627:cc1dc02d047c user: Roman Arutyunyan date: Thu Sep 17 16:10:11 2026 +0400 description: HTTP/2: reset reusable connection status on stream creation. Previously, an HTTP/2 connection could be reusable while having streams. This could result in an attempt to drain the connection while processing one if its streams, for example when connecting to an upstream. After recognizing that the connection has streams, an attempt to send the GOAWAY frame was made. On send failure, the connection was immediately closed and its pool released. This triggered a use-after-free up the stack. Having an HTTP/2 connection with streams registered as reusable became possible after 76672e650. A connection with no streams and a partial frame read from client was registered as reusable to avoid DoS attacks. So if a client sends only the first HEADERS frame byte, the connection becomes reusable. Later, when the remaining HEADERS bytes are received and a new stream is created, the reusable status is not reset until the connection becomes idle. Fix is to mark the connection non-reusable upon stream creation. Reported by Albert @ Vexera AI. Obtained from: https://github.com/nginx/nginx/commit/2df48a501d0fb8212b7d39dffeeff5876332ba59 diffstat: src/http/v2/ngx_http_v2.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -3158,6 +3158,8 @@ ngx_http_v2_create_stream(ngx_http_v2_co h2c->processing++; + ngx_reusable_connection(h2c->connection, 0); + h2c->priority_limit += h2scf->concurrent_streams; if (h2c->connection->read->timer_set) { From mdounin at mdounin.ru Tue Nov 24 15:44:36 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:36 +0300 Subject: [nginx] QUIC: avoid main connection reuse after creating a stream. Message-ID: details: http://freenginx.org/hg/nginx/rev/b90af330120e branches: stable-1.30 changeset: 9628:b90af330120e user: Roman Arutyunyan date: Sun Nov 01 16:46:22 2026 +0400 description: QUIC: avoid main connection reuse after creating a stream. Previously, ngx_quic_create_stream() cleared the main connection's reusable flag and then called ngx_get_connection() before inserting the new stream into the tree. If the worker was low on free connections, the drain inside ngx_get_connection() could close an idle stream of the same main connection. Since the new stream was not in the tree yet, that close found no remaining streams and marked the main connection reusable again. Once reusable, the connection could later be drained while processing one of its streams, for example when connecting to an upstream, freeing it while still in use. Fix is to insert the new stream into the tree before calling ngx_get_connection(), so the main connection is not considered idle. Reported by Xint.io. Obtained from: https://github.com/nginx/nginx/commit/b5252dae1ca0d4c516b8bcffd9fa7fd967b73075 diffstat: src/event/quic/ngx_event_quic_streams.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diffs (36 lines): diff --git a/src/event/quic/ngx_event_quic_streams.c b/src/event/quic/ngx_event_quic_streams.c --- a/src/event/quic/ngx_event_quic_streams.c +++ b/src/event/quic/ngx_event_quic_streams.c @@ -723,12 +723,15 @@ ngx_quic_create_stream(ngx_connection_t addr_text.data = NULL; } + ngx_rbtree_insert(&qc->streams.tree, &qs->node); + reusable = c->reusable; ngx_reusable_connection(c, 0); sc = ngx_get_connection(c->fd, log); if (sc == NULL) { ngx_destroy_pool(pool); + ngx_rbtree_delete(&qc->streams.tree, &qs->node); ngx_queue_insert_tail(&qc->streams.free, &qs->queue); ngx_reusable_connection(c, reusable); return NULL; @@ -795,6 +798,7 @@ ngx_quic_create_stream(ngx_connection_t if (cln == NULL) { ngx_close_connection(sc); ngx_destroy_pool(pool); + ngx_rbtree_delete(&qc->streams.tree, &qs->node); ngx_queue_insert_tail(&qc->streams.free, &qs->queue); ngx_reusable_connection(c, reusable); return NULL; @@ -803,8 +807,6 @@ ngx_quic_create_stream(ngx_connection_t cln->handler = ngx_quic_stream_cleanup_handler; cln->data = sc; - ngx_rbtree_insert(&qc->streams.tree, &qs->node); - return qs; } From mdounin at mdounin.ru Tue Nov 24 15:44:36 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:36 +0300 Subject: [nginx] Mail: blocked client write events during various operati... Message-ID: details: http://freenginx.org/hg/nginx/rev/ef3ed1c4bcd2 branches: stable-1.30 changeset: 9629:ef3ed1c4bcd2 user: Maxim Dounin date: Tue Nov 24 06:19:51 2026 +0300 description: Mail: blocked client write events during various operations. Previously, only read events were blocked during various operations, notably during auth_http requests, connecting to upstream servers, and DNS resolution in SMTP. With ngx_mail_send() as a write event handler, this might result in use-after-free if ngx_mail_send() is called due to a write event and closes the session due to an error, while an ongoing operation, such as an auth_http request, still references it (CVE-2026-113425). The fix is to block write events similarly to how read events are currently blocked during corresponding operations. See also: https://github.com/nginx/nginx/commit/df9d8d940ecb83a50b1e55ccc296d0a29cfe774c https://github.com/nginx/nginx/commit/e2d23d45fa93ed236a9cdedcb54271e0a064c4f3 https://github.com/nginx/nginx/commit/5deda780a9d5d1bcd5c6731d3118fa090ae900cc https://github.com/nginx/nginx/commit/4c5ace9f1d5419334a2e6772a0885ee7ed3d6e91 diffstat: src/mail/ngx_mail_auth_http_module.c | 27 +++++++++++++++++++++++++++ src/mail/ngx_mail_proxy_module.c | 19 +++++++++++++++++++ src/mail/ngx_mail_smtp_handler.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 0 deletions(-) diffs (175 lines): diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c --- a/src/mail/ngx_mail_auth_http_module.c +++ b/src/mail/ngx_mail_auth_http_module.c @@ -74,6 +74,7 @@ static void ngx_mail_auth_send_error(ngx static ngx_int_t ngx_mail_auth_http_parse_header_line(ngx_mail_session_t *s, ngx_mail_auth_http_ctx_t *ctx); static void ngx_mail_auth_http_block_read(ngx_event_t *rev); +static void ngx_mail_auth_http_block_write(ngx_event_t *wev); static void ngx_mail_auth_http_dummy_handler(ngx_event_t *ev); static ngx_buf_t *ngx_mail_auth_http_create_request(ngx_mail_session_t *s, ngx_pool_t *pool, ngx_mail_auth_http_conf_t *ahcf); @@ -231,6 +232,7 @@ ngx_mail_auth_http_init(ngx_mail_session ctx->peer.connection->pool = s->connection->pool; s->connection->read->handler = ngx_mail_auth_http_block_read; + s->connection->write->handler = ngx_mail_auth_http_block_write; ctx->peer.connection->read->handler = ngx_mail_auth_http_read_handler; ctx->peer.connection->write->handler = ngx_mail_auth_http_write_handler; @@ -783,6 +785,8 @@ ngx_mail_auth_http_process_headers(ngx_m ngx_close_connection(ctx->peer.connection); + s->connection->write->handler = ngx_mail_send; + if (ctx->err.len) { ngx_log_error(NGX_LOG_INFO, s->connection->log, 0, @@ -1254,6 +1258,29 @@ ngx_mail_auth_http_block_read(ngx_event_ static void +ngx_mail_auth_http_block_write(ngx_event_t *wev) +{ + ngx_connection_t *c; + ngx_mail_session_t *s; + ngx_mail_auth_http_ctx_t *ctx; + + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, + "mail auth http block write"); + + if (ngx_handle_write_event(wev, 0) != NGX_OK) { + c = wev->data; + s = c->data; + + ctx = ngx_mail_get_module_ctx(s, ngx_mail_auth_http_module); + + ngx_close_connection(ctx->peer.connection); + ngx_destroy_pool(ctx->pool); + ngx_mail_session_internal_server_error(s); + } +} + + +static void ngx_mail_auth_http_dummy_handler(ngx_event_t *ev) { ngx_log_debug0(NGX_LOG_DEBUG_MAIL, ev->log, 0, diff --git a/src/mail/ngx_mail_proxy_module.c b/src/mail/ngx_mail_proxy_module.c --- a/src/mail/ngx_mail_proxy_module.c +++ b/src/mail/ngx_mail_proxy_module.c @@ -24,6 +24,7 @@ typedef struct { static void ngx_mail_proxy_block_read(ngx_event_t *rev); +static void ngx_mail_proxy_block_write(ngx_event_t *wev); static void ngx_mail_proxy_pop3_handler(ngx_event_t *rev); static void ngx_mail_proxy_imap_handler(ngx_event_t *rev); static void ngx_mail_proxy_smtp_handler(ngx_event_t *rev); @@ -165,6 +166,7 @@ ngx_mail_proxy_init(ngx_mail_session_t * p->upstream.connection->pool = s->connection->pool; s->connection->read->handler = ngx_mail_proxy_block_read; + s->connection->write->handler = ngx_mail_proxy_block_write; p->upstream.connection->write->handler = ngx_mail_proxy_write_handler; pcf = ngx_mail_get_module_srv_conf(s, ngx_mail_proxy_module); @@ -224,6 +226,23 @@ ngx_mail_proxy_block_read(ngx_event_t *r static void +ngx_mail_proxy_block_write(ngx_event_t *wev) +{ + ngx_connection_t *c; + ngx_mail_session_t *s; + + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, "mail proxy block write"); + + if (ngx_handle_read_event(wev, 0) != NGX_OK) { + c = wev->data; + s = c->data; + + ngx_mail_proxy_close_session(s); + } +} + + +static void ngx_mail_proxy_pop3_handler(ngx_event_t *rev) { u_char *p; diff --git a/src/mail/ngx_mail_smtp_handler.c b/src/mail/ngx_mail_smtp_handler.c --- a/src/mail/ngx_mail_smtp_handler.c +++ b/src/mail/ngx_mail_smtp_handler.c @@ -16,6 +16,7 @@ static void ngx_mail_smtp_resolve_addr_h static void ngx_mail_smtp_resolve_name(ngx_event_t *rev); static void ngx_mail_smtp_resolve_name_handler(ngx_resolver_ctx_t *ctx); static void ngx_mail_smtp_block_reading(ngx_event_t *rev); +static void ngx_mail_smtp_block_writing(ngx_event_t *wev); static void ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c); static void ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev); static ngx_int_t ngx_mail_smtp_create_buffer(ngx_mail_session_t *s, @@ -91,6 +92,7 @@ ngx_mail_smtp_init_session(ngx_mail_sess s->resolver_ctx = ctx; c->read->handler = ngx_mail_smtp_block_reading; + c->write->handler = ngx_mail_smtp_block_writing; if (ngx_resolve_addr(ctx) != NGX_OK) { ngx_mail_close_connection(c); @@ -278,6 +280,38 @@ ngx_mail_smtp_block_reading(ngx_event_t static void +ngx_mail_smtp_block_writing(ngx_event_t *wev) +{ + ngx_connection_t *c; + ngx_mail_session_t *s; + ngx_resolver_ctx_t *ctx; + + c = wev->data; + s = c->data; + + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, c->log, 0, "smtp writing blocked"); + + if (ngx_handle_write_event(wev, 0) != NGX_OK) { + + if (s->resolver_ctx) { + ctx = s->resolver_ctx; + + if (ctx->handler == ngx_mail_smtp_resolve_addr_handler) { + ngx_resolve_addr_done(ctx); + + } else if (ctx->handler == ngx_mail_smtp_resolve_name_handler) { + ngx_resolve_name_done(ctx); + } + + s->resolver_ctx = NULL; + } + + ngx_mail_close_connection(c); + } +} + + +static void ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c) { ngx_msec_t timeout; @@ -307,6 +341,7 @@ ngx_mail_smtp_greeting(ngx_mail_session_ } c->read->handler = ngx_mail_smtp_init_protocol; + c->write->handler = ngx_mail_send; s->out = sscf->greeting; @@ -336,6 +371,7 @@ ngx_mail_smtp_invalid_pipelining(ngx_eve cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module); c->read->handler = ngx_mail_smtp_init_protocol; + c->write->handler = ngx_mail_send; ngx_add_timer(c->read, cscf->timeout); From mdounin at mdounin.ru Tue Nov 24 15:44:36 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:36 +0300 Subject: [nginx] Updated zlib used for win32 builds. Message-ID: details: http://freenginx.org/hg/nginx/rev/c50d7af0527f branches: stable-1.30 changeset: 9630:c50d7af0527f user: Maxim Dounin date: Tue Nov 24 06:20:51 2026 +0300 description: Updated zlib used for win32 builds. diffstat: misc/GNUmakefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff --git a/misc/GNUmakefile b/misc/GNUmakefile --- a/misc/GNUmakefile +++ b/misc/GNUmakefile @@ -7,7 +7,7 @@ TEMP = tmp CC = cl OBJS = objs.msvc8 OPENSSL = openssl-3.5.9 -ZLIB = zlib-1.3.2 +ZLIB = zlib-1.4 PCRE = pcre2-10.49 From mdounin at mdounin.ru Tue Nov 24 15:44:36 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:36 +0300 Subject: [nginx] Fixed typo. Message-ID: details: http://freenginx.org/hg/nginx/rev/b98613b3a8b6 branches: stable-1.30 changeset: 9631:b98613b3a8b6 user: Maxim Dounin date: Tue Nov 24 16:39:35 2026 +0300 description: Fixed typo. diffstat: docs/xml/nginx/changes.xml | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml --- a/docs/xml/nginx/changes.xml +++ b/docs/xml/nginx/changes.xml @@ -20,7 +20,7 @@ one of the keys was left uninitialized when using automatic rotation of TLS session ticket keys, making it possible to forge a session -and bypass client certificate verification (CVE-2026-97629); +and bypass client certificate verification (CVE-2026-97629). From mdounin at mdounin.ru Tue Nov 24 15:44:36 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:36 +0300 Subject: [nginx] freenginx-1.30.3-RELEASE Message-ID: details: http://freenginx.org/hg/nginx/rev/0c50bdcb34ab branches: stable-1.30 changeset: 9632:0c50bdcb34ab user: Maxim Dounin date: Tue Nov 24 17:28:14 2026 +0300 description: freenginx-1.30.3-RELEASE diffstat: docs/xml/nginx/changes.xml | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 0 deletions(-) diffs (77 lines): diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml --- a/docs/xml/nginx/changes.xml +++ b/docs/xml/nginx/changes.xml @@ -7,6 +7,73 @@
+ + + + +??? ????????????? HTTP/2 +???????????? ???? ?????????? ??????? +????? ??????? ??????????? ?????? ???????? ????????, +??? ???????????? ????? ????????? ? ?????????? ????????????? ???? +(CVE-2026-123007). + + +a flow control window overflow +might cause memory corruption in a worker process +when using HTTP/2, +potentially resulting in arbitrary code execution +(CVE-2026-123007). + + + + + +??? ????????????? HTTP/2 +????? ??????????? ????????? ? ????? ????????????? ??????, +??? ???????????? ????? ????????? ? ?????????? ????????????? ???? +(CVE-2026-123633). + + +use-after-free might occur +when using HTTP/2, +potentially resulting in arbitrary code execution +(CVE-2026-123633). + + + + + +??? ????????????? HTTP/3 +????? ??????????? ????????? ? ????? ????????????? ??????, +??? ???????????? ????? ????????? ? ?????????? ????????????? ???? +(CVE-2026-121810). + + +use-after-free might occur +when using HTTP/3, +potentially resulting in arbitrary code execution +(CVE-2026-121810). + + + + + +??? ????????????? ????????? ??????-??????? +????? ??????????? ????????? ? ????? ????????????? ??????, +??? ???????????? ????? ????????? ? ?????????? ????????????? ???? +(CVE-2026-113425). + + +use-after-free might occur +when using the mail proxy module, +potentially resulting in arbitrary code execution +(CVE-2026-113425). + + + + + + From mdounin at mdounin.ru Tue Nov 24 15:44:36 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:44:36 +0300 Subject: [nginx] release-1.30.3 tag Message-ID: details: http://freenginx.org/hg/nginx/rev/94aaccca5b18 branches: stable-1.30 changeset: 9633:94aaccca5b18 user: Maxim Dounin date: Tue Nov 24 17:28:16 2026 +0300 description: release-1.30.3 tag diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -496,3 +496,4 @@ cac0fa5721386abbec57dcc2bb317f2531456e19 f126ef64a014db167927741688c74ffdf1b0fc26 release-1.30.0 3945b69e1c4218e98a85a7a0e152e77c9d4fc83b release-1.30.1 dc19dd157ae15beb5df6a3acd250b19528b2eb84 release-1.30.2 +0c50bdcb34ab9be2ebf950108052b672373e6101 release-1.30.3 From mdounin at mdounin.ru Tue Nov 24 15:50:23 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Tue, 24 Nov 2026 18:50:23 +0300 Subject: [nginx-site] freenginx-1.31.6, freenginx-1.30.3 Message-ID: details: http://freenginx.org/hg/nginx-site/rev/2819eb484ddb branches: changeset: 3140:2819eb484ddb user: Maxim Dounin date: Tue Nov 24 18:46:45 2026 +0300 description: freenginx-1.31.6, freenginx-1.30.3 diffstat: text/en/CHANGES | 29 ++++++++++++++++++++++++++++- text/en/CHANGES-1.30 | 19 ++++++++++++++++++- text/ru/CHANGES.ru | 30 ++++++++++++++++++++++++++++++ text/ru/CHANGES.ru-1.30 | 20 ++++++++++++++++++++ xml/en/security_advisories.xml | 28 ++++++++++++++++++++++++++++ xml/index.xml | 13 +++++++++++++ xml/versions.xml | 2 ++ 7 files changed, 139 insertions(+), 2 deletions(-) diffs (218 lines): diff --git a/text/en/CHANGES b/text/en/CHANGES --- a/text/en/CHANGES +++ b/text/en/CHANGES @@ -1,9 +1,36 @@ +Changes with freenginx 1.31.6 24 Nov 2026 + + *) Security: a flow control window overflow might cause memory + corruption in a worker process when using HTTP/2, potentially + resulting in arbitrary code execution (CVE-2026-123007). + + *) Security: use-after-free might occur when using HTTP/2, potentially + resulting in arbitrary code execution (CVE-2026-123633). + + *) Security: use-after-free might occur when using HTTP/3, potentially + resulting in arbitrary code execution (CVE-2026-121810). + + *) Security: use-after-free might occur when using the mail proxy + module, potentially resulting in arbitrary code execution + (CVE-2026-113425). + + *) Bugfix: a segmentation fault might occur in a worker process if the + "resolver" directive was used in subrequests. + + *) Bugfix: excessive CPU usage might be observed when using the + "ssl_early_data" directive. + + *) Workaround: OpenSSL might be rebuilt unexpectedly when using the + --with-openssl option to build OpenSSL 4.1. + Thanks to nisbet-hubbard. + + Changes with freenginx 1.31.5 27 Oct 2026 *) Security: one of the keys was left uninitialized when using automatic rotation of TLS session ticket keys, making it possible to forge a - session and bypass client certificate verification (CVE-2026-97629); + session and bypass client certificate verification (CVE-2026-97629). *) Bugfix: a segmentation fault might occur in a worker process if AIO was used in subrequests. diff --git a/text/en/CHANGES-1.30 b/text/en/CHANGES-1.30 --- a/text/en/CHANGES-1.30 +++ b/text/en/CHANGES-1.30 @@ -1,9 +1,26 @@ +Changes with freenginx 1.30.3 24 Nov 2026 + + *) Security: a flow control window overflow might cause memory + corruption in a worker process when using HTTP/2, potentially + resulting in arbitrary code execution (CVE-2026-123007). + + *) Security: use-after-free might occur when using HTTP/2, potentially + resulting in arbitrary code execution (CVE-2026-123633). + + *) Security: use-after-free might occur when using HTTP/3, potentially + resulting in arbitrary code execution (CVE-2026-121810). + + *) Security: use-after-free might occur when using the mail proxy + module, potentially resulting in arbitrary code execution + (CVE-2026-113425). + + Changes with freenginx 1.30.2 27 Oct 2026 *) Security: one of the keys was left uninitialized when using automatic rotation of TLS session ticket keys, making it possible to forge a - session and bypass client certificate verification (CVE-2026-97629); + session and bypass client certificate verification (CVE-2026-97629). Changes with freenginx 1.30.1 02 Jun 2026 diff --git a/text/ru/CHANGES.ru b/text/ru/CHANGES.ru --- a/text/ru/CHANGES.ru +++ b/text/ru/CHANGES.ru @@ -1,4 +1,34 @@ +????????? ? freenginx 1.31.6 24.11.2026 + + *) ????????????: ??? ????????????? HTTP/2 ???????????? ???? ?????????? + ??????? ????? ??????? ??????????? ?????? ???????? ????????, ??? + ???????????? ????? ????????? ? ?????????? ????????????? ???? + (CVE-2026-123007). + + *) ????????????: ??? ????????????? HTTP/2 ????? ??????????? ????????? ? + ????? ????????????? ??????, ??? ???????????? ????? ????????? ? + ?????????? ????????????? ???? (CVE-2026-123633). + + *) ????????????: ??? ????????????? HTTP/3 ????? ??????????? ????????? ? + ????? ????????????? ??????, ??? ???????????? ????? ????????? ? + ?????????? ????????????? ???? (CVE-2026-121810). + + *) ????????????: ??? ????????????? ????????? ??????-??????? ????? + ??????????? ????????? ? ????? ????????????? ??????, ??? ???????????? + ????? ????????? ? ?????????? ????????????? ???? (CVE-2026-113425). + + *) ???????????: ??? ????????????? ????????? resolver ? ??????????? ? + ??????? ???????? ??? ????????? segmentation fault. + + *) ???????????: ??? ????????????? ????????? ssl_early_data ????? + ??????????? ?????????? ??????????? ???????? ??????????. + + *) ?????????: ??? ????????????? ????????? --with-openssl ??? ?????? + OpenSSL 4.1 ????? ?????????? ??????????? ????????? ?????? OpenSSL. + ??????? nisbet-hubbard. + + ????????? ? freenginx 1.31.5 27.10.2026 *) ????????????: ??? ?????????????? ????????? ?????? ?????????? TLS diff --git a/text/ru/CHANGES.ru-1.30 b/text/ru/CHANGES.ru-1.30 --- a/text/ru/CHANGES.ru-1.30 +++ b/text/ru/CHANGES.ru-1.30 @@ -1,4 +1,24 @@ +????????? ? freenginx 1.30.3 24.11.2026 + + *) ????????????: ??? ????????????? HTTP/2 ???????????? ???? ?????????? + ??????? ????? ??????? ??????????? ?????? ???????? ????????, ??? + ???????????? ????? ????????? ? ?????????? ????????????? ???? + (CVE-2026-123007). + + *) ????????????: ??? ????????????? HTTP/2 ????? ??????????? ????????? ? + ????? ????????????? ??????, ??? ???????????? ????? ????????? ? + ?????????? ????????????? ???? (CVE-2026-123633). + + *) ????????????: ??? ????????????? HTTP/3 ????? ??????????? ????????? ? + ????? ????????????? ??????, ??? ???????????? ????? ????????? ? + ?????????? ????????????? ???? (CVE-2026-121810). + + *) ????????????: ??? ????????????? ????????? ??????-??????? ????? + ??????????? ????????? ? ????? ????????????? ??????, ??? ???????????? + ????? ????????? ? ?????????? ????????????? ???? (CVE-2026-113425). + + ????????? ? freenginx 1.30.2 27.10.2026 *) ????????????: ??? ?????????????? ????????? ?????? ?????????? TLS diff --git a/xml/en/security_advisories.xml b/xml/en/security_advisories.xml --- a/xml/en/security_advisories.xml +++ b/xml/en/security_advisories.xml @@ -25,6 +25,34 @@ Patches are signed using one of the + + + + + + + + + + + + + + +freenginx-1.30.3 +stable and +freenginx-1.31.6 +mainline versions has been released, +addressing +vulnerabilities +in HTTP/2, HTTP/3, and the mail proxy module +(CVE-2026-123007, CVE-2026-123633, CVE-2026-121810, CVE-2026-113425). + + + freenginx-1.30.2 diff --git a/xml/versions.xml b/xml/versions.xml --- a/xml/versions.xml +++ b/xml/versions.xml @@ -9,6 +9,7 @@ + @@ -21,6 +22,7 @@ + From msadkov at netflix.com Tue Nov 24 21:17:50 2026 From: msadkov at netflix.com (Michael Sadkov) Date: Tue, 24 Nov 2026 16:17:50 -0500 Subject: [PATCH 08 of 10] Mail: blocked client write events during various operations In-Reply-To: <44b4a8b577914dac92d0.1795480031@vm-bsd.mdounin.ru> References: <44b4a8b577914dac92d0.1795480031@vm-bsd.mdounin.ru> Message-ID: Hello, I am curious if the call to ngx_handle_read_event from ngx_mail_proxy_block_write is an intentional change as compared to https://github.com/nginx/nginx/commit/5deda780a9d5d1bcd5c6731d3118fa090ae900cc, where ngx_handle_write_event is called instead? Thanks! On Mon, Nov 23, 2026 at 7:27?PM Maxim Dounin wrote: > # HG changeset patch > # User Maxim Dounin > # Date 1795479850 -10800 > # Tue Nov 24 03:24:10 2026 +0300 > # Node ID 44b4a8b577914dac92d0c22fb40716986ef1c7b6 > # Parent 90dde4a8dc4da2fe1bb0adc6ea063d08206e6186 > Mail: blocked client write events during various operations. > > Previously, only read events were blocked during various operations, > notably during auth_http requests, connecting to upstream servers, and > DNS resolution in SMTP. With ngx_mail_send() as a write event handler, > this might result in use-after-free if ngx_mail_send() is called due to > a write event and closes the session due to an error, while an ongoing > operation, such as an auth_http request, still references it > (CVE-2026-113425). > > The fix is to block write events similarly to how read events are > currently blocked during corresponding operations. > > See also: > > https://github.com/nginx/nginx/commit/df9d8d940ecb83a50b1e55ccc296d0a29cfe774c > > https://github.com/nginx/nginx/commit/e2d23d45fa93ed236a9cdedcb54271e0a064c4f3 > > https://github.com/nginx/nginx/commit/5deda780a9d5d1bcd5c6731d3118fa090ae900cc > > https://github.com/nginx/nginx/commit/4c5ace9f1d5419334a2e6772a0885ee7ed3d6e91 > > diff --git a/src/mail/ngx_mail_auth_http_module.c > b/src/mail/ngx_mail_auth_http_module.c > --- a/src/mail/ngx_mail_auth_http_module.c > +++ b/src/mail/ngx_mail_auth_http_module.c > @@ -74,6 +74,7 @@ static void ngx_mail_auth_send_error(ngx > static ngx_int_t ngx_mail_auth_http_parse_header_line(ngx_mail_session_t > *s, > ngx_mail_auth_http_ctx_t *ctx); > static void ngx_mail_auth_http_block_read(ngx_event_t *rev); > +static void ngx_mail_auth_http_block_write(ngx_event_t *wev); > static void ngx_mail_auth_http_dummy_handler(ngx_event_t *ev); > static ngx_buf_t *ngx_mail_auth_http_create_request(ngx_mail_session_t *s, > ngx_pool_t *pool, ngx_mail_auth_http_conf_t *ahcf); > @@ -231,6 +232,7 @@ ngx_mail_auth_http_init(ngx_mail_session > ctx->peer.connection->pool = s->connection->pool; > > s->connection->read->handler = ngx_mail_auth_http_block_read; > + s->connection->write->handler = ngx_mail_auth_http_block_write; > ctx->peer.connection->read->handler = ngx_mail_auth_http_read_handler; > ctx->peer.connection->write->handler = > ngx_mail_auth_http_write_handler; > > @@ -783,6 +785,8 @@ ngx_mail_auth_http_process_headers(ngx_m > > ngx_close_connection(ctx->peer.connection); > > + s->connection->write->handler = ngx_mail_send; > + > if (ctx->err.len) { > > ngx_log_error(NGX_LOG_INFO, s->connection->log, 0, > @@ -1254,6 +1258,29 @@ ngx_mail_auth_http_block_read(ngx_event_ > > > static void > +ngx_mail_auth_http_block_write(ngx_event_t *wev) > +{ > + ngx_connection_t *c; > + ngx_mail_session_t *s; > + ngx_mail_auth_http_ctx_t *ctx; > + > + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, > + "mail auth http block write"); > + > + if (ngx_handle_write_event(wev, 0) != NGX_OK) { > + c = wev->data; > + s = c->data; > + > + ctx = ngx_mail_get_module_ctx(s, ngx_mail_auth_http_module); > + > + ngx_close_connection(ctx->peer.connection); > + ngx_destroy_pool(ctx->pool); > + ngx_mail_session_internal_server_error(s); > + } > +} > + > + > +static void > ngx_mail_auth_http_dummy_handler(ngx_event_t *ev) > { > ngx_log_debug0(NGX_LOG_DEBUG_MAIL, ev->log, 0, > diff --git a/src/mail/ngx_mail_proxy_module.c > b/src/mail/ngx_mail_proxy_module.c > --- a/src/mail/ngx_mail_proxy_module.c > +++ b/src/mail/ngx_mail_proxy_module.c > @@ -24,6 +24,7 @@ typedef struct { > > > static void ngx_mail_proxy_block_read(ngx_event_t *rev); > +static void ngx_mail_proxy_block_write(ngx_event_t *wev); > static void ngx_mail_proxy_pop3_handler(ngx_event_t *rev); > static void ngx_mail_proxy_imap_handler(ngx_event_t *rev); > static void ngx_mail_proxy_smtp_handler(ngx_event_t *rev); > @@ -165,6 +166,7 @@ ngx_mail_proxy_init(ngx_mail_session_t * > p->upstream.connection->pool = s->connection->pool; > > s->connection->read->handler = ngx_mail_proxy_block_read; > + s->connection->write->handler = ngx_mail_proxy_block_write; > p->upstream.connection->write->handler = ngx_mail_proxy_write_handler; > > pcf = ngx_mail_get_module_srv_conf(s, ngx_mail_proxy_module); > @@ -224,6 +226,23 @@ ngx_mail_proxy_block_read(ngx_event_t *r > > > static void > +ngx_mail_proxy_block_write(ngx_event_t *wev) > +{ > + ngx_connection_t *c; > + ngx_mail_session_t *s; > + > + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, "mail proxy block > write"); > + > + if (ngx_handle_read_event(wev, 0) != NGX_OK) { > + c = wev->data; > + s = c->data; > + > + ngx_mail_proxy_close_session(s); > + } > +} > + > + > +static void > ngx_mail_proxy_pop3_handler(ngx_event_t *rev) > { > u_char *p; > diff --git a/src/mail/ngx_mail_smtp_handler.c > b/src/mail/ngx_mail_smtp_handler.c > --- a/src/mail/ngx_mail_smtp_handler.c > +++ b/src/mail/ngx_mail_smtp_handler.c > @@ -16,6 +16,7 @@ static void ngx_mail_smtp_resolve_addr_h > static void ngx_mail_smtp_resolve_name(ngx_event_t *rev); > static void ngx_mail_smtp_resolve_name_handler(ngx_resolver_ctx_t *ctx); > static void ngx_mail_smtp_block_reading(ngx_event_t *rev); > +static void ngx_mail_smtp_block_writing(ngx_event_t *wev); > static void ngx_mail_smtp_greeting(ngx_mail_session_t *s, > ngx_connection_t *c); > static void ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev); > static ngx_int_t ngx_mail_smtp_create_buffer(ngx_mail_session_t *s, > @@ -91,6 +92,7 @@ ngx_mail_smtp_init_session(ngx_mail_sess > > s->resolver_ctx = ctx; > c->read->handler = ngx_mail_smtp_block_reading; > + c->write->handler = ngx_mail_smtp_block_writing; > > if (ngx_resolve_addr(ctx) != NGX_OK) { > ngx_mail_close_connection(c); > @@ -278,6 +280,38 @@ ngx_mail_smtp_block_reading(ngx_event_t > > > static void > +ngx_mail_smtp_block_writing(ngx_event_t *wev) > +{ > + ngx_connection_t *c; > + ngx_mail_session_t *s; > + ngx_resolver_ctx_t *ctx; > + > + c = wev->data; > + s = c->data; > + > + ngx_log_debug0(NGX_LOG_DEBUG_MAIL, c->log, 0, "smtp writing blocked"); > + > + if (ngx_handle_write_event(wev, 0) != NGX_OK) { > + > + if (s->resolver_ctx) { > + ctx = s->resolver_ctx; > + > + if (ctx->handler == ngx_mail_smtp_resolve_addr_handler) { > + ngx_resolve_addr_done(ctx); > + > + } else if (ctx->handler == > ngx_mail_smtp_resolve_name_handler) { > + ngx_resolve_name_done(ctx); > + } > + > + s->resolver_ctx = NULL; > + } > + > + ngx_mail_close_connection(c); > + } > +} > + > + > +static void > ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c) > { > ngx_msec_t timeout; > @@ -307,6 +341,7 @@ ngx_mail_smtp_greeting(ngx_mail_session_ > } > > c->read->handler = ngx_mail_smtp_init_protocol; > + c->write->handler = ngx_mail_send; > > s->out = sscf->greeting; > > @@ -336,6 +371,7 @@ ngx_mail_smtp_invalid_pipelining(ngx_eve > cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module); > > c->read->handler = ngx_mail_smtp_init_protocol; > + c->write->handler = ngx_mail_send; > > ngx_add_timer(c->read, cscf->timeout); > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdounin at mdounin.ru Tue Nov 24 23:15:41 2026 From: mdounin at mdounin.ru (Maxim Dounin) Date: Wed, 25 Nov 2026 02:15:41 +0300 Subject: [PATCH 08 of 10] Mail: blocked client write events during various operations In-Reply-To: References: <44b4a8b577914dac92d0.1795480031@vm-bsd.mdounin.ru> Message-ID: Hello! On Tue, Nov 24, 2026 at 04:17:50PM -0500, Michael Sadkov via nginx-devel wrote: > I am curious if the call to ngx_handle_read_event from > ngx_mail_proxy_block_write is an intentional change as compared to > https://github.com/nginx/nginx/commit/5deda780a9d5d1bcd5c6731d3118fa090ae900cc, > where ngx_handle_write_event is called instead? Not intentional, thanks for catching this! # HG changeset patch # User Maxim Dounin # Date 1795561951 -10800 # Wed Nov 25 02:12:31 2026 +0300 # Node ID e8053e6ad3e5b95eef9c87e21b1824e3916ba54d # Parent 372f3bb3258b99336789fdddc7c13e63b17c7f8f Mail: fixed wrong ngx_handle_read_event() call. Reported by Michael Sadkov. diff --git a/src/mail/ngx_mail_proxy_module.c b/src/mail/ngx_mail_proxy_module.c --- a/src/mail/ngx_mail_proxy_module.c +++ b/src/mail/ngx_mail_proxy_module.c @@ -233,7 +233,7 @@ ngx_mail_proxy_block_write(ngx_event_t * ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, "mail proxy block write"); - if (ngx_handle_read_event(wev, 0) != NGX_OK) { + if (ngx_handle_write_event(wev, 0) != NGX_OK) { c = wev->data; s = c->data; -- Maxim Dounin http://mdounin.ru/ From mdounin at mdounin.ru Wed Nov 25 02:00:02 2026 From: mdounin at mdounin.ru (=?utf-8?q?Maxim_Dounin?=) Date: Wed, 25 Nov 2026 05:00:02 +0300 Subject: [PATCH] Style Message-ID: <12e90138bdde7c566ef0.1795572002@vm-bsd.mdounin.ru> # HG changeset patch # User Maxim Dounin # Date 1795570092 -10800 # Wed Nov 25 04:28:12 2026 +0300 # Node ID 12e90138bdde7c566ef0f0e063c190a813e2d841 # Parent e8053e6ad3e5b95eef9c87e21b1824e3916ba54d Style. diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c --- a/src/core/ngx_resolver.c +++ b/src/core/ngx_resolver.c @@ -1299,7 +1299,7 @@ ngx_resolver_send_query(ngx_resolver_t * static ngx_int_t -ngx_resolver_send_udp_query(ngx_resolver_t *r, ngx_resolver_connection_t *rec, +ngx_resolver_send_udp_query(ngx_resolver_t *r, ngx_resolver_connection_t *rec, u_char *query, u_short qlen) { ssize_t n; @@ -1406,7 +1406,7 @@ ngx_resolver_send_tcp_query(ngx_resolver b = rec->write_buf; - if (b->end - b->last < 2 + qlen) { + if (b->end - b->last < 2 + qlen) { ngx_log_error(NGX_LOG_CRIT, &rec->log, 0, "buffer overflow"); return NGX_ERROR; } diff --git a/src/event/quic/ngx_event_quic_bpf.c b/src/event/quic/ngx_event_quic_bpf.c --- a/src/event/quic/ngx_event_quic_bpf.c +++ b/src/event/quic/ngx_event_quic_bpf.c @@ -416,7 +416,7 @@ ngx_quic_bpf_get_group(ngx_cycle_t *cycl static ngx_int_t -ngx_quic_bpf_group_add_socket(ngx_cycle_t *cycle, ngx_listening_t *ls) +ngx_quic_bpf_group_add_socket(ngx_cycle_t *cycle, ngx_listening_t *ls) { uint64_t cookie; ngx_quic_bpf_conf_t *bcf; diff --git a/src/http/modules/ngx_http_index_module.c b/src/http/modules/ngx_http_index_module.c --- a/src/http/modules/ngx_http_index_module.c +++ b/src/http/modules/ngx_http_index_module.c @@ -388,7 +388,7 @@ ngx_http_index_test_dir(ngx_http_request static ngx_int_t -ngx_http_index_error(ngx_http_request_t *r, ngx_http_core_loc_conf_t *clcf, +ngx_http_index_error(ngx_http_request_t *r, ngx_http_core_loc_conf_t *clcf, u_char *file, ngx_err_t err) { if (err == NGX_EACCES) { diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2863,7 +2863,7 @@ ngx_http_upstream_test_connect(ngx_conne #if (NGX_HAVE_KQUEUE) - if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { + if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { if (c->write->pending_eof || c->read->pending_eof) { if (c->write->pending_eof) { err = c->write->kq_errno; diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c --- a/src/mail/ngx_mail_auth_http_module.c +++ b/src/mail/ngx_mail_auth_http_module.c @@ -402,7 +402,7 @@ ngx_mail_auth_http_ignore_status_line(ng ngx_mail_auth_http_ctx_t *ctx) { u_char *p, ch; - enum { + enum { sw_start = 0, sw_H, sw_HT, diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c --- a/src/stream/ngx_stream_proxy_module.c +++ b/src/stream/ngx_stream_proxy_module.c @@ -1516,7 +1516,7 @@ ngx_stream_proxy_test_connect(ngx_connec #if (NGX_HAVE_KQUEUE) - if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { + if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { err = c->write->kq_errno ? c->write->kq_errno : c->read->kq_errno; if (err) { From mdounin at mdounin.ru Mon Nov 30 04:04:32 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Mon, 30 Nov 2026 07:04:32 +0300 Subject: [nginx] Version bump. Message-ID: details: http://freenginx.org/hg/nginx/rev/ac159c9dce58 branches: changeset: 9634:ac159c9dce58 user: Maxim Dounin date: Mon Nov 30 07:03:26 2026 +0300 description: Version bump. diffstat: src/core/nginx.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff --git a/src/core/nginx.h b/src/core/nginx.h --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -9,8 +9,8 @@ #define _NGINX_H_INCLUDED_ -#define nginx_version 1031006 -#define NGINX_VERSION "1.31.6" +#define nginx_version 1031007 +#define NGINX_VERSION "1.31.7" #define freenginx 1 From mdounin at mdounin.ru Mon Nov 30 04:04:32 2026 From: mdounin at mdounin.ru (=?iso-8859-1?q?Maxim_Dounin?=) Date: Mon, 30 Nov 2026 07:04:32 +0300 Subject: [nginx] Mail: fixed wrong ngx_handle_read_event() call. Message-ID: details: http://freenginx.org/hg/nginx/rev/b994eafcb52a branches: changeset: 9635:b994eafcb52a user: Maxim Dounin date: Mon Nov 30 07:03:31 2026 +0300 description: Mail: fixed wrong ngx_handle_read_event() call. Reported by Michael Sadkov. diffstat: src/mail/ngx_mail_proxy_module.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff --git a/src/mail/ngx_mail_proxy_module.c b/src/mail/ngx_mail_proxy_module.c --- a/src/mail/ngx_mail_proxy_module.c +++ b/src/mail/ngx_mail_proxy_module.c @@ -233,7 +233,7 @@ ngx_mail_proxy_block_write(ngx_event_t * ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, "mail proxy block write"); - if (ngx_handle_read_event(wev, 0) != NGX_OK) { + if (ngx_handle_write_event(wev, 0) != NGX_OK) { c = wev->data; s = c->data;