Mercurial > hg > nginx
annotate auto/os/conf @ 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 | 489839d07b38 |
children | a88e309f839b |
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:
355
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:
355
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:
355
diff
changeset
|
4 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 |
563 | 6 echo "checking for $NGX_SYSTEM specific features" |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 |
493 | 8 case "$NGX_PLATFORM" in |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 |
688
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
10 FreeBSD:*) |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 . auto/os/freebsd |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 ;; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
13 |
196
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
14 Linux:*) |
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
15 . auto/os/linux |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
16 ;; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
17 |
196
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
18 SunOS:*) |
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
19 . auto/os/solaris |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
20 ;; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
21 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
940
diff
changeset
|
22 Darwin:*) |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
940
diff
changeset
|
23 . auto/os/darwin |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
940
diff
changeset
|
24 ;; |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
940
diff
changeset
|
25 |
2828
f5c80c69a72e
backout -r2827 and add correct fix
Igor Sysoev <igor@sysoev.ru>
parents:
2826
diff
changeset
|
26 win32) |
455 | 27 . auto/os/win32 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 ;; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
29 |
688
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
30 DragonFly:*) |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
31 have=NGX_FREEBSD . auto/have_headers |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
32 CORE_INCS="$UNIX_INCS" |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
33 CORE_DEPS="$UNIX_DEPS $FREEBSD_DEPS" |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
34 CORE_SRCS="$UNIX_SRCS $FREEBSD_SRCS" |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
35 |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
36 echo " + sendfile() found" |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
37 have=NGX_HAVE_SENDFILE . auto/have |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
38 CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS" |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
39 |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
40 ngx_spacer=' |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
41 ' |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
42 ;; |
03fa118203d6
separate DragonFlyBSD autoconfiguration from FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
593
diff
changeset
|
43 |
515 | 44 HP-UX:*) |
45 # HP/UX | |
46 have=NGX_HPUX . auto/have_headers | |
47 CORE_INCS="$UNIX_INCS" | |
48 CORE_DEPS="$UNIX_DEPS $POSIX_DEPS" | |
49 CORE_SRCS="$UNIX_SRCS" | |
50 CC_AUX_FLAGS="$CC_AUX_FLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1" | |
4692
489839d07b38
Fixed "sendmsg() failed" alerts on HP-UX.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4690
diff
changeset
|
51 CC_AUX_FLAGS="$CC_AUX_FLAGS -D_HPUX_ALT_XOPEN_SOCKET_API" |
515 | 52 ;; |
53 | |
54 OSF1:*) | |
517 | 55 # Tru64 UNIX |
515 | 56 have=NGX_TRU64 . auto/have_headers |
517 | 57 have=NGX_HAVE_STRERROR_R . auto/nohave |
515 | 58 CORE_INCS="$UNIX_INCS" |
59 CORE_DEPS="$UNIX_DEPS $POSIX_DEPS" | |
60 CORE_SRCS="$UNIX_SRCS" | |
61 ;; | |
62 | |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
320
diff
changeset
|
63 *) |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
320
diff
changeset
|
64 CORE_INCS="$UNIX_INCS" |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
320
diff
changeset
|
65 CORE_DEPS="$UNIX_DEPS $POSIX_DEPS" |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
320
diff
changeset
|
66 CORE_SRCS="$UNIX_SRCS" |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
320
diff
changeset
|
67 ;; |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
320
diff
changeset
|
68 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
69 esac |
455 | 70 |
71 | |
493 | 72 case "$NGX_MACHINE" in |
479 | 73 |
589 | 74 i386 | i686 | i86pc) |
509 | 75 have=NGX_HAVE_NONALIGNED . auto/have |
589 | 76 NGX_MACH_CACHE_LINE=32 |
77 ;; | |
78 | |
593 | 79 amd64 | x86_64) |
589 | 80 have=NGX_HAVE_NONALIGNED . auto/have |
81 NGX_MACH_CACHE_LINE=64 | |
509 | 82 ;; |
479 | 83 |
745 | 84 sun4u | sun4v | sparc | sparc64) |
581 | 85 have=NGX_ALIGNMENT value=16 . auto/define |
589 | 86 # TODO |
87 NGX_MACH_CACHE_LINE=64 | |
88 ;; | |
89 | |
90 ia64 ) | |
91 have=NGX_ALIGNMENT value=16 . auto/define | |
92 # TODO | |
93 NGX_MACH_CACHE_LINE=64 | |
94 ;; | |
95 | |
96 *) | |
4690
d91f3c78603e
Changed default alignment to 16.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
97 have=NGX_ALIGNMENT value=16 . auto/define |
589 | 98 NGX_MACH_CACHE_LINE=32 |
581 | 99 ;; |
100 | |
479 | 101 esac |
589 | 102 |
103 if test -z "$NGX_CPU_CACHE_LINE"; then | |
104 NGX_CPU_CACHE_LINE=$NGX_MACH_CACHE_LINE | |
105 fi | |
106 | |
107 have=NGX_CPU_CACHE_LINE value=$NGX_CPU_CACHE_LINE . auto/define |