From: Willy Tarreau Date: Tue, 16 Oct 2018 15:32:55 +0000 (+0200) Subject: Revert "BUILD: lua: silence some compiler warnings about potential null derefs" X-Git-Tag: v1.9-dev4~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=526aed219f83eb86f1ee578e8e5233f11edf34ea;p=thirdparty%2Fhaproxy.git Revert "BUILD: lua: silence some compiler warnings about potential null derefs" This reverts commit f1ffb39b614b0d9654c9450ac6e8c88cfc942784. It breaks Lua causing some timeouts. Removing the __unreachable() statement from WILL_LJMP() fixes it. It's very strange and unclear whether it's an issue with WILL_LJMP() not fullfilling its promise of not returning, if the code emitted with __unreachable() gets broken, or anything else. Let's revert this for now. --- diff --git a/src/hlua.c b/src/hlua.c index fe7c9097a4..aaa884073d 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -25,7 +25,6 @@ #include #include -#include #include #include @@ -68,7 +67,7 @@ * MAY_LJMP() marks an lua function that may use longjmp. */ #define __LJMP -#define WILL_LJMP(func) do { func; __unreachable(); } while (0) +#define WILL_LJMP(func) func #define MAY_LJMP(func) func /* This couple of function executes securely some Lua calls outside of @@ -2362,7 +2361,7 @@ __LJMP static int hlua_socket_connect_yield(struct lua_State *L, int status, lua return 2; } - appctx = __objt_appctx(s->si[0].end); + appctx = objt_appctx(s->si[0].end); /* Check for connection established. */ if (appctx->ctx.hlua_cosocket.connected) { @@ -2474,7 +2473,7 @@ __LJMP static int hlua_socket_connect(struct lua_State *L) } hlua = hlua_gethlua(L); - appctx = __objt_appctx(s->si[0].end); + appctx = objt_appctx(s->si[0].end); /* inform the stream that we want to be notified whenever the * connection completes. @@ -5724,9 +5723,6 @@ static int hlua_register_task(lua_State *L) WILL_LJMP(luaL_error(L, "Lua out of memory error.")); task = task_new(MAX_THREADS_MASK); - if (!task) - WILL_LJMP(luaL_error(L, "Lua out of memory error.")); - task->context = hlua; task->process = hlua_process_task;