Mercurial > hg > nginx
annotate auto/lib/openssl/make @ 6359:dac6eda40475 stable-1.8
Resolver: fixed use-after-free memory accesses with CNAME.
When several requests were waiting for a response, then after getting
a CNAME response only the last request's context had the name updated.
Contexts of other requests had the wrong name. This name was used by
ngx_resolve_name_done() to find the node to remove the request context
from. When the name was wrong, the request could not be properly
cancelled, its context was freed but stayed linked to the node's waiting
list. This happened e.g. when the first request was aborted or timed
out before the resolving completed. When it completed, this triggered
a use-after-free memory access by calling ctx->handler of already freed
request context. The bug manifests itself by
"could not cancel <name> resolving" alerts in error_log.
When a request was responded with a CNAME, the request context kept
the pointer to the original node's rn->u.cname. If the original node
expired before the resolving timed out or completed with an error,
this would trigger a use-after-free memory access via ctx->name in
ctx->handler().
The fix is to keep ctx->name unmodified. The name from context
is no longer used by ngx_resolve_name_done(). Instead, we now keep
the pointer to resolver node to which this request is linked.
Keeping the original name intact also improves logging.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Tue, 26 Jan 2016 16:46:59 +0300 |
parents | 83d54192e97b |
children | 09d5a22c76bd |
rev | line source |
---|---|
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
399
diff
changeset
|
1 |
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
399
diff
changeset
|
2 # Copyright (C) Igor Sysoev |
4412 | 3 # Copyright (C) Nginx, Inc. |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
399
diff
changeset
|
4 |
583 | 5 |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
6 case "$CC" in |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
7 |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
8 cl) |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
9 |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
10 cat << END >> $NGX_MAKEFILE |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
11 |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
12 $OPENSSL/openssl/include/openssl/ssl.h: $NGX_MAKEFILE |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
13 \$(MAKE) -f auto/lib/openssl/makefile.msvc \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
14 OPENSSL="$OPENSSL" OPENSSL_OPT="$OPENSSL_OPT" |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
15 |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
16 END |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
17 |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
18 ;; |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
19 |
2897
d5d3fe7197cc
*) use no-threads for Unix builds only
Igor Sysoev <igor@sysoev.ru>
parents:
2879
diff
changeset
|
20 bcc32) |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
21 |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
22 ngx_opt=`echo "-DOPENSSL=\"$OPENSSL\" -DOPENSSL_OPT=\"$OPENSSL_OPT\"" \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
23 | sed -e "s/\//$ngx_regex_dirsep/g"` |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
24 |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
25 cat << END >> $NGX_MAKEFILE |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
26 |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
27 `echo "$OPENSSL\\openssl\\lib\\libeay32.lib: \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
28 $OPENSSL\\openssl\\include\\openssl\\ssl.h" \ |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
29 | sed -e "s/\//$ngx_regex_dirsep/g"` |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
30 |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
31 `echo "$OPENSSL\\openssl\\lib\\ssleay32.lib: \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
32 $OPENSSL\\openssl\\include\\openssl\\ssl.h" \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
33 | sed -e "s/\//$ngx_regex_dirsep/g"` |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
34 |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
35 `echo "$OPENSSL\\openssl\\include\\openssl\\ssl.h: $NGX_MAKEFILE" \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
36 | sed -e "s/\//$ngx_regex_dirsep/g"` |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
37 \$(MAKE) -f auto/lib/openssl/makefile.bcc $ngx_opt |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
38 |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
39 END |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
40 |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
41 ;; |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
42 |
399
4e21d1291a14
nginx-0.0.7-2004-07-25-22:34:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
43 *) |
2897
d5d3fe7197cc
*) use no-threads for Unix builds only
Igor Sysoev <igor@sysoev.ru>
parents:
2879
diff
changeset
|
44 case $OPENSSL in |
3168
83c940b0d18a
allow "make clean" for OpenSSL, the bug was introduced in r2874
Igor Sysoev <igor@sysoev.ru>
parents:
2897
diff
changeset
|
45 /*) ngx_prefix="$OPENSSL/.openssl" ;; |
83c940b0d18a
allow "make clean" for OpenSSL, the bug was introduced in r2874
Igor Sysoev <igor@sysoev.ru>
parents:
2897
diff
changeset
|
46 *) ngx_prefix="$PWD/$OPENSSL/.openssl" ;; |
2879
824d885aa0b1
allow absolute path in --with-openssl=
Igor Sysoev <igor@sysoev.ru>
parents:
2873
diff
changeset
|
47 esac |
824d885aa0b1
allow absolute path in --with-openssl=
Igor Sysoev <igor@sysoev.ru>
parents:
2873
diff
changeset
|
48 |
501 | 49 cat << END >> $NGX_MAKEFILE |
50 | |
3168
83c940b0d18a
allow "make clean" for OpenSSL, the bug was introduced in r2874
Igor Sysoev <igor@sysoev.ru>
parents:
2897
diff
changeset
|
51 $OPENSSL/.openssl/include/openssl/ssl.h: $NGX_MAKEFILE |
501 | 52 cd $OPENSSL \\ |
5438
f817f9d1cded
Configure: call "make clean" for OpenSSL only if Makefile exists.
Piotr Sikora <piotr@cloudflare.com>
parents:
4412
diff
changeset
|
53 && if [ -f Makefile ]; then \$(MAKE) clean; fi \\ |
2879
824d885aa0b1
allow absolute path in --with-openssl=
Igor Sysoev <igor@sysoev.ru>
parents:
2873
diff
changeset
|
54 && ./config --prefix=$ngx_prefix no-shared $OPENSSL_OPT \\ |
2873 | 55 && \$(MAKE) \\ |
3492
ee529182e59f
fix building OpenSSL-1.0.0 on 64-bit Linux:
Igor Sysoev <igor@sysoev.ru>
parents:
3168
diff
changeset
|
56 && \$(MAKE) install LIBDIR=lib |
501 | 57 |
58 END | |
59 | |
399
4e21d1291a14
nginx-0.0.7-2004-07-25-22:34:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
60 ;; |
4e21d1291a14
nginx-0.0.7-2004-07-25-22:34:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
61 |
4e21d1291a14
nginx-0.0.7-2004-07-25-22:34:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
62 esac |