From 445ca90f068e949ee0eecda51f30fdc1887cb3d3 Mon Sep 17 00:00:00 2001 From: "Yichun Zhang (agentzh)" Date: Mon, 6 Oct 2014 23:45:48 -0700 Subject: [PATCH] bugfix: applied a patch to the nginx core to fix the memory invalid reads when exceeding the pre-configured limits in an ngx_hash_t hash table. also upgraded ngx_lua to 0.9.13rc1. --- patches/nginx-1.7.5-hash_overflow.patch | 20 ++++++++++++++++++++ util/mirror-tarballs | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 patches/nginx-1.7.5-hash_overflow.patch diff --git a/patches/nginx-1.7.5-hash_overflow.patch b/patches/nginx-1.7.5-hash_overflow.patch new file mode 100644 index 0000000..449d214 --- /dev/null +++ b/patches/nginx-1.7.5-hash_overflow.patch @@ -0,0 +1,20 @@ +# HG changeset patch +# User Yichun Zhang +# Date 1412276417 25200 +# Thu Oct 02 12:00:17 2014 -0700 +# Node ID 4032b992f23b054c1a2cfb0be879330d2c6708e5 +# Parent 1ff0f68d9376e3d184d65814a6372856bf65cfcd +Hash: buffer overflow might happen when exceeding the pre-configured limits. + +diff -r 1ff0f68d9376 -r 4032b992f23b src/core/ngx_hash.c +--- a/src/core/ngx_hash.c Tue Sep 30 15:50:28 2014 -0700 ++++ b/src/core/ngx_hash.c Thu Oct 02 12:00:17 2014 -0700 +@@ -312,6 +312,8 @@ ngx_hash_init(ngx_hash_init_t *hinit, ng + continue; + } + ++ size--; ++ + ngx_log_error(NGX_LOG_WARN, hinit->pool->log, 0, + "could not build optimal %s, you should increase " + "either %s_max_size: %i or %s_bucket_size: %i; " diff --git a/util/mirror-tarballs b/util/mirror-tarballs index 27d1d17..4df3dee 100755 --- a/util/mirror-tarballs +++ b/util/mirror-tarballs @@ -270,6 +270,10 @@ echo "$info_txt applying the resolver_del_event_invalid_read patch for nginx" patch -p1 < $root/patches/nginx-$main_ver-resolver_del_event_invalid_read.patch || exit 1 echo +echo "$info_txt applying the hash_overflow patch for nginx" +patch -p1 < $root/patches/nginx-$main_ver-hash_overflow.patch || exit 1 +echo + rm -f *.patch || exit 1 cd .. || exit 1 @@ -339,7 +343,7 @@ mv openresty-drizzle-nginx-module-* drizzle-nginx-module-$ver || exit 1 ################################# -ver=0.9.12 +ver=0.9.13rc1 $root/util/get-tarball "https://github.com/openresty/lua-nginx-module/tarball/v$ver" -O lua-nginx-module-$ver.tar.gz || exit 1 tar -xzf lua-nginx-module-$ver.tar.gz || exit 1 mv openresty-lua-nginx-module-* ngx_lua-$ver || exit 1