aboutsummaryrefslogtreecommitdiffstats
path: root/main/varnish/fix-stack-overflow.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2016-03-02 11:00:12 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2016-03-02 11:22:03 +0100
commit2e4fa20349066e203b84df45a3ec428ecc827a39 (patch)
tree75295c5ce151bfeeaba6b0cdaac9cbc9aeaddeff /main/varnish/fix-stack-overflow.patch
parent585e9be30225c2b01ca5770d995753116496e833 (diff)
downloadaports-2e4fa20349066e203b84df45a3ec428ecc827a39.tar.bz2
aports-2e4fa20349066e203b84df45a3ec428ecc827a39.tar.xz
main/varnish: fix stack overflow
ref #4938
Diffstat (limited to 'main/varnish/fix-stack-overflow.patch')
-rw-r--r--main/varnish/fix-stack-overflow.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/main/varnish/fix-stack-overflow.patch b/main/varnish/fix-stack-overflow.patch
new file mode 100644
index 0000000000..67677b3306
--- /dev/null
+++ b/main/varnish/fix-stack-overflow.patch
@@ -0,0 +1,44 @@
+From bc0b56b8703e7e02af745af28bc6fff48ab806ba Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Wed, 2 Mar 2016 10:46:49 +0100
+Subject: [PATCH] fix stack overflow in epoll waiter
+
+musl libc has a default thread stack of 80k. avoid overflow the stack by
+allocating the epol_event array on heap instead of stack.
+---
+ bin/varnishd/waiter/cache_waiter_epoll.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/bin/varnishd/waiter/cache_waiter_epoll.c b/bin/varnishd/waiter/cache_waiter_epoll.c
+index f50ae46..65719e5 100644
+--- a/bin/varnishd/waiter/cache_waiter_epoll.c
++++ b/bin/varnishd/waiter/cache_waiter_epoll.c
+@@ -71,7 +71,7 @@ struct vwe {
+ static void *
+ vwe_thread(void *priv)
+ {
+- struct epoll_event ev[NEEV], *ep;
++ struct epoll_event *ev, *ep;
+ struct waited *wp;
+ struct waiter *w;
+ double now, then;
+@@ -83,6 +83,8 @@ vwe_thread(void *priv)
+ w = vwe->waiter;
+ CHECK_OBJ_NOTNULL(w, WAITER_MAGIC);
+ THR_SetName("cache-epoll");
++ ev = malloc(NEEV * sizeof(struct epoll_event));
++ assert(ev != NULL);
+
+ now = VTIM_real();
+ while (1) {
+@@ -146,6 +148,7 @@ vwe_thread(void *priv)
+ AZ(close(vwe->pipe[0]));
+ AZ(close(vwe->pipe[1]));
+ AZ(close(vwe->epfd));
++ free(ev);
+ return (NULL);
+ }
+
+--
+2.7.2
+