Mercurial > hg > nginx
annotate auto/lib/pcre/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 | 3d2d3e1cf427 |
children | 78f8ac479735 |
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:
297
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:
297
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:
297
diff
changeset
|
4 |
274
a1ea1ecc3eac
nginx-0.0.2-2004-03-01-23:00:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 |
467 | 6 case "$NGX_CC_NAME" in |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
7 |
467 | 8 msvc*) |
9 ngx_makefile=makefile.msvc | |
503 | 10 ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC" |
2838
ecdc41bf2047
backout r2833: CURDIR was set to Unix style path
Igor Sysoev <igor@sysoev.ru>
parents:
2832
diff
changeset
|
11 ngx_pcre="PCRE=\"$PCRE\"" |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
12 ;; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
13 |
467 | 14 owc*) |
15 ngx_makefile=makefile.owc | |
503 | 16 ngx_opt="CPU_OPT=\"$CPU_OPT\"" |
2838
ecdc41bf2047
backout r2833: CURDIR was set to Unix style path
Igor Sysoev <igor@sysoev.ru>
parents:
2832
diff
changeset
|
17 ngx_pcre=`echo PCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"` |
297
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
295
diff
changeset
|
18 ;; |
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
295
diff
changeset
|
19 |
467 | 20 bcc) |
21 ngx_makefile=makefile.bcc | |
503 | 22 ngx_opt="-DCPU_OPT=\"$CPU_OPT\"" |
2838
ecdc41bf2047
backout r2833: CURDIR was set to Unix style path
Igor Sysoev <igor@sysoev.ru>
parents:
2832
diff
changeset
|
23 ngx_pcre=`echo \-DPCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"` |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
24 ;; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
25 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
26 *) |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
27 ngx_makefile= |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
28 ;; |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
29 |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
30 esac |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
31 |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
32 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
33 if [ -n "$ngx_makefile" ]; then |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
34 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
35 cat << END >> $NGX_MAKEFILE |
297
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
295
diff
changeset
|
36 |
5342
b3f6290a9401
Configure: pcre.lib dependencies fix.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
37 `echo "$PCRE/pcre.lib: $PCRE/pcre.h $NGX_MAKEFILE" \ |
b3f6290a9401
Configure: pcre.lib dependencies fix.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
38 | sed -e "s/\//$ngx_regex_dirsep/g"` |
2840
22c4c012c8c9
switch Win32 building to modern PCRE versions (starting from 7.1)
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
39 \$(MAKE) -f auto/lib/pcre/$ngx_makefile $ngx_pcre $ngx_opt |
297
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
295
diff
changeset
|
40 |
2840
22c4c012c8c9
switch Win32 building to modern PCRE versions (starting from 7.1)
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
41 `echo "$PCRE/pcre.h:" | sed -e "s/\//$ngx_regex_dirsep/g"` |
22c4c012c8c9
switch Win32 building to modern PCRE versions (starting from 7.1)
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
42 \$(MAKE) -f auto/lib/pcre/$ngx_makefile $ngx_pcre pcre.h |
297
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
295
diff
changeset
|
43 |
467 | 44 END |
45 | |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
46 else |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
47 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
48 cat << END >> $NGX_MAKEFILE |
467 | 49 |
1164
d201e0461c3c
fix make dependecies: pcre-6.5+ already has pcre.h
Igor Sysoev <igor@sysoev.ru>
parents:
523
diff
changeset
|
50 $PCRE/pcre.h: $PCRE/Makefile |
d201e0461c3c
fix make dependecies: pcre-6.5+ already has pcre.h
Igor Sysoev <igor@sysoev.ru>
parents:
523
diff
changeset
|
51 |
d201e0461c3c
fix make dependecies: pcre-6.5+ already has pcre.h
Igor Sysoev <igor@sysoev.ru>
parents:
523
diff
changeset
|
52 $PCRE/Makefile: $NGX_MAKEFILE |
467 | 53 cd $PCRE \\ |
523 | 54 && if [ -f Makefile ]; then \$(MAKE) distclean; fi \\ |
467 | 55 && CC="\$(CC)" CFLAGS="$PCRE_OPT" \\ |
4388
005fc2d5e84f
Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents:
2840
diff
changeset
|
56 ./configure --disable-shared $PCRE_CONF_OPT |
467 | 57 |
1164
d201e0461c3c
fix make dependecies: pcre-6.5+ already has pcre.h
Igor Sysoev <igor@sysoev.ru>
parents:
523
diff
changeset
|
58 $PCRE/.libs/libpcre.a: $PCRE/Makefile |
467 | 59 cd $PCRE \\ |
60 && \$(MAKE) libpcre.la | |
61 | |
62 END | |
63 | |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
64 fi |