Skip to content

Commit 6b612c8

Browse files
committed
update nginx to v1.25.4
1 parent c89cb14 commit 6b612c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1222
-589
lines changed

CHANGES

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,47 @@
11

2+
Changes with nginx 1.25.4 14 Feb 2024
3+
4+
*) Security: when using HTTP/3 a segmentation fault might occur in a
5+
worker process while processing a specially crafted QUIC session
6+
(CVE-2024-24989, CVE-2024-24990).
7+
8+
*) Bugfix: connections with pending AIO operations might be closed
9+
prematurely during graceful shutdown of old worker processes.
10+
11+
*) Bugfix: socket leak alerts no longer logged when fast shutdown was
12+
requested after graceful shutdown of old worker processes.
13+
14+
*) Bugfix: a socket descriptor error, a socket leak, or a segmentation
15+
fault in a worker process (for SSL proxying) might occur if AIO was
16+
used in a subrequest.
17+
18+
*) Bugfix: a segmentation fault might occur in a worker process if SSL
19+
proxying was used along with the "image_filter" directive and errors
20+
with code 415 were redirected with the "error_page" directive.
21+
22+
*) Bugfixes and improvements in HTTP/3.
23+
24+
25+
Changes with nginx 1.25.3 24 Oct 2023
26+
27+
*) Change: improved detection of misbehaving clients when using HTTP/2.
28+
29+
*) Feature: startup speedup when using a large number of locations.
30+
Thanks to Yusuke Nojima.
31+
32+
*) Bugfix: a segmentation fault might occur in a worker process when
33+
using HTTP/2 without SSL; the bug had appeared in 1.25.1.
34+
35+
*) Bugfix: the "Status" backend response header line with an empty
36+
reason phrase was handled incorrectly.
37+
38+
*) Bugfix: memory leak during reconfiguration when using the PCRE2
39+
library.
40+
Thanks to ZhenZhong Wu.
41+
42+
*) Bugfixes and improvements in HTTP/3.
43+
44+
245
Changes with nginx 1.25.2 15 Aug 2023
346

447
*) Feature: path MTU discovery when using HTTP/3.

CHANGES.ru

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,51 @@
11

2+
Изменения в nginx 1.25.4 14.02.2024
3+
4+
*) Безопасность: при использовании HTTP/3 в рабочем процессе мог
5+
произойти segmentation fault во время обработки специально созданной
6+
QUIC-сессии (CVE-2024-24989, CVE-2024-24990).
7+
8+
*) Исправление: соединения с незавершенными AIO-операциями могли
9+
закрываться преждевременно во время плавного завершения старых
10+
рабочих процессов.
11+
12+
*) Исправление: теперь nginx не пишет в лог сообщения об утечке сокетов,
13+
если во время плавного завершения старых рабочих процессов было
14+
запрошено быстрое завершение.
15+
16+
*) Исправление: при использовании AIO в подзапросе могла происходить
17+
ошибка на сокете, утечка сокетов, либо segmentation fault в рабочем
18+
процессе (при SSL-проксировании).
19+
20+
*) Исправление: в рабочем процессе мог произойти segmentation fault,
21+
если использовалось SSL-проксирование и директива image_filter, а
22+
ошибки с кодом 415 перенаправлялись с помощью директивы error_page.
23+
24+
*) Исправления и улучшения в HTTP/3.
25+
26+
27+
Изменения в nginx 1.25.3 24.10.2023
28+
29+
*) Изменение: улучшено детектирование некорректного поведения клиентов
30+
при использовании HTTP/2.
31+
32+
*) Добавление: уменьшение времени запуска при использовании большого
33+
количества location'ов.
34+
Спасибо Yusuke Nojima.
35+
36+
*) Исправление: при использовании HTTP/2 без SSL в рабочем процессе мог
37+
произойти segmentation fault; ошибка появилась в 1.25.1.
38+
39+
*) Исправление: строка "Status" в заголовке ответа бэкенда с пустой
40+
поясняющей фразой обрабатывалась некорректно.
41+
42+
*) Исправление: утечки памяти во время переконфигурации при
43+
использовании библиотеки PCRE2.
44+
Спасибо ZhenZhong Wu.
45+
46+
*) Исправления и улучшения в HTTP/3.
47+
48+
249
Изменения в nginx 1.25.2 15.08.2023
350
451
*) Добавление: path MTU discovery при использовании HTTP/3.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (C) 2002-2021 Igor Sysoev
3-
* Copyright (C) 2011-2023 Nginx, Inc.
3+
* Copyright (C) 2011-2024 Nginx, Inc.
44
* All rights reserved.
55
*
66
* Redistribution and use in source and binary forms, with or without

src/core/nginx.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#define _NGINX_H_INCLUDED_
1010

1111

12-
#define nginx_version 1025002
13-
#define NGINX_VERSION "1.25.2"
12+
#define nginx_version 1025004
13+
#define NGINX_VERSION "1.25.4"
1414
#define NGINX_VER "nginx/" NGINX_VERSION
1515

1616
#ifdef NGX_BUILD

src/core/ngx_module.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@
107107
#endif
108108

109109
#define NGX_MODULE_SIGNATURE_17 "0"
110+
111+
#if (NGX_QUIC || NGX_COMPAT)
112+
#define NGX_MODULE_SIGNATURE_18 "1"
113+
#else
110114
#define NGX_MODULE_SIGNATURE_18 "0"
115+
#endif
111116

112117
#if (NGX_HAVE_OPENAT)
113118
#define NGX_MODULE_SIGNATURE_19 "1"

src/core/ngx_queue.c

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#include <ngx_core.h>
1010

1111

12+
static void ngx_queue_merge(ngx_queue_t *queue, ngx_queue_t *tail,
13+
ngx_int_t (*cmp)(const ngx_queue_t *, const ngx_queue_t *));
14+
15+
1216
/*
1317
* find the middle queue element if the queue has odd number of elements
1418
* or the first element of the queue's second part otherwise
@@ -45,36 +49,58 @@ ngx_queue_middle(ngx_queue_t *queue)
4549
}
4650

4751

48-
/* the stable insertion sort */
52+
/* the stable merge sort */
4953

5054
void
5155
ngx_queue_sort(ngx_queue_t *queue,
5256
ngx_int_t (*cmp)(const ngx_queue_t *, const ngx_queue_t *))
5357
{
54-
ngx_queue_t *q, *prev, *next;
58+
ngx_queue_t *q, tail;
5559

5660
q = ngx_queue_head(queue);
5761

5862
if (q == ngx_queue_last(queue)) {
5963
return;
6064
}
6165

62-
for (q = ngx_queue_next(q); q != ngx_queue_sentinel(queue); q = next) {
66+
q = ngx_queue_middle(queue);
67+
68+
ngx_queue_split(queue, q, &tail);
69+
70+
ngx_queue_sort(queue, cmp);
71+
ngx_queue_sort(&tail, cmp);
72+
73+
ngx_queue_merge(queue, &tail, cmp);
74+
}
75+
6376

64-
prev = ngx_queue_prev(q);
65-
next = ngx_queue_next(q);
77+
static void
78+
ngx_queue_merge(ngx_queue_t *queue, ngx_queue_t *tail,
79+
ngx_int_t (*cmp)(const ngx_queue_t *, const ngx_queue_t *))
80+
{
81+
ngx_queue_t *q1, *q2;
6682

67-
ngx_queue_remove(q);
83+
q1 = ngx_queue_head(queue);
84+
q2 = ngx_queue_head(tail);
6885

69-
do {
70-
if (cmp(prev, q) <= 0) {
71-
break;
72-
}
86+
for ( ;; ) {
87+
if (q1 == ngx_queue_sentinel(queue)) {
88+
ngx_queue_add(queue, tail);
89+
break;
90+
}
7391

74-
prev = ngx_queue_prev(prev);
92+
if (q2 == ngx_queue_sentinel(tail)) {
93+
break;
94+
}
95+
96+
if (cmp(q1, q2) <= 0) {
97+
q1 = ngx_queue_next(q1);
98+
continue;
99+
}
75100

76-
} while (prev != ngx_queue_sentinel(queue));
101+
ngx_queue_remove(q2);
102+
ngx_queue_insert_before(q1, q2);
77103

78-
ngx_queue_insert_after(prev, q);
104+
q2 = ngx_queue_head(tail);
79105
}
80106
}

src/core/ngx_queue.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ struct ngx_queue_s {
4747
(h)->prev = x
4848

4949

50+
#define ngx_queue_insert_before ngx_queue_insert_tail
51+
52+
5053
#define ngx_queue_head(h) \
5154
(h)->next
5255

src/core/ngx_regex.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,8 @@ ngx_regex_cleanup(void *data)
600600
* the new cycle, these will be re-allocated.
601601
*/
602602

603+
ngx_regex_malloc_init(NULL);
604+
603605
if (ngx_regex_compile_context) {
604606
pcre2_compile_context_free(ngx_regex_compile_context);
605607
ngx_regex_compile_context = NULL;
@@ -611,6 +613,8 @@ ngx_regex_cleanup(void *data)
611613
ngx_regex_match_data_size = 0;
612614
}
613615

616+
ngx_regex_malloc_done();
617+
614618
#endif
615619
}
616620

@@ -706,9 +710,6 @@ ngx_regex_module_init(ngx_cycle_t *cycle)
706710
ngx_regex_malloc_done();
707711

708712
ngx_regex_studies = NULL;
709-
#if (NGX_PCRE2)
710-
ngx_regex_compile_context = NULL;
711-
#endif
712713

713714
return NGX_OK;
714715
}

src/event/ngx_event_openssl.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,8 @@ ngx_ssl_info_callback(const ngx_ssl_conn_t *ssl_conn, int where, int ret)
11051105
BIO *rbio, *wbio;
11061106
ngx_connection_t *c;
11071107

1108-
#ifndef SSL_OP_NO_RENEGOTIATION
1108+
#if (!defined SSL_OP_NO_RENEGOTIATION \
1109+
&& !defined SSL_OP_NO_CLIENT_RENEGOTIATION)
11091110

11101111
if ((where & SSL_CB_HANDSHAKE_START)
11111112
&& SSL_is_server((ngx_ssl_conn_t *) ssl_conn))
@@ -1838,18 +1839,17 @@ ngx_ssl_handshake(ngx_connection_t *c)
18381839
c->read->ready = 1;
18391840
c->write->ready = 1;
18401841

1841-
#ifndef SSL_OP_NO_RENEGOTIATION
1842-
#if OPENSSL_VERSION_NUMBER < 0x10100000L
1843-
#ifdef SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS
1842+
#if (!defined SSL_OP_NO_RENEGOTIATION \
1843+
&& !defined SSL_OP_NO_CLIENT_RENEGOTIATION \
1844+
&& defined SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS \
1845+
&& OPENSSL_VERSION_NUMBER < 0x10100000L)
18441846

18451847
/* initial handshake done, disable renegotiation (CVE-2009-3555) */
18461848
if (c->ssl->connection->s3 && SSL_is_server(c->ssl->connection)) {
18471849
c->ssl->connection->s3->flags |= SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS;
18481850
}
18491851

18501852
#endif
1851-
#endif
1852-
#endif
18531853

18541854
#if (defined BIO_get_ktls_send && !NGX_WIN32)
18551855

@@ -2483,7 +2483,8 @@ ngx_ssl_handle_recv(ngx_connection_t *c, int n)
24832483
int sslerr;
24842484
ngx_err_t err;
24852485

2486-
#ifndef SSL_OP_NO_RENEGOTIATION
2486+
#if (!defined SSL_OP_NO_RENEGOTIATION \
2487+
&& !defined SSL_OP_NO_CLIENT_RENEGOTIATION)
24872488

24882489
if (c->ssl->renegotiation) {
24892490
/*
@@ -5186,6 +5187,9 @@ ngx_ssl_get_curves(ngx_connection_t *c, ngx_pool_t *pool, ngx_str_t *s)
51865187
}
51875188

51885189
curves = ngx_palloc(pool, n * sizeof(int));
5190+
if (curves == NULL) {
5191+
return NGX_ERROR;
5192+
}
51895193

51905194
n = SSL_get1_curves(c->ssl->connection, curves);
51915195
len = 0;

src/event/ngx_event_openssl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
#if (defined LIBRESSL_VERSION_NUMBER && OPENSSL_VERSION_NUMBER == 0x20000000L)
4747
#undef OPENSSL_VERSION_NUMBER
48-
#if (LIBRESSL_VERSION_NUMBER >= 0x2080000fL)
48+
#if (LIBRESSL_VERSION_NUMBER >= 0x3050000fL)
4949
#define OPENSSL_VERSION_NUMBER 0x1010000fL
5050
#else
5151
#define OPENSSL_VERSION_NUMBER 0x1000107fL

src/event/ngx_event_openssl_stapling.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ ngx_ssl_ocsp_validate(ngx_connection_t *c)
893893
ocsp->cert_status = V_OCSP_CERTSTATUS_GOOD;
894894
ocsp->conf = ocf;
895895

896-
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined LIBRESSL_VERSION_NUMBER)
896+
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
897897

898898
ocsp->certs = SSL_get0_verified_chain(c->ssl->connection);
899899

src/event/ngx_event_pipe.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ ngx_event_pipe(ngx_event_pipe_t *p, ngx_int_t do_write)
5757
do_write = 1;
5858
}
5959

60-
if (p->upstream->fd != (ngx_socket_t) -1) {
60+
if (p->upstream
61+
&& p->upstream->fd != (ngx_socket_t) -1)
62+
{
6163
rev = p->upstream->read;
6264

6365
flags = (rev->eof || rev->error) ? NGX_CLOSE_EVENT : 0;
@@ -108,7 +110,9 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p)
108110
ngx_msec_t delay;
109111
ngx_chain_t *chain, *cl, *ln;
110112

111-
if (p->upstream_eof || p->upstream_error || p->upstream_done) {
113+
if (p->upstream_eof || p->upstream_error || p->upstream_done
114+
|| p->upstream == NULL)
115+
{
112116
return NGX_OK;
113117
}
114118

0 commit comments

Comments
 (0)