]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: hlua: get rid of hlua_traceback() security checks
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 4 Jun 2024 08:52:44 +0000 (10:52 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 4 Jun 2024 14:31:22 +0000 (16:31 +0200)
Thanks to the previous commit, we may now assume that hlua_traceback()
won't LJMP, so it's safe to use it from unprotected environment without
any precautions.

src/hlua.c

index cd6619b3b7520e8dfd350bb18fa7fea0787f1fe2..227d3b60ca2610964b435f1e5fd45ee7a6d351ea 100644 (file)
@@ -9786,19 +9786,11 @@ static struct task *hlua_event_runner(struct task *task, void *context, unsigned
                event_hdl_pause(hlua_sub->sub);
                hlua_sub->paused = 1;
 
-               if (SET_SAFE_LJMP(hlua_sub->hlua)) {
-                       /* The following Lua call may fail. */
-                       trace = hlua_traceback(hlua_sub->hlua->T, ", ");
-                       /* At this point the execution is safe. */
-                       RESET_SAFE_LJMP(hlua_sub->hlua);
-               } else {
-                       /* Lua error was raised while fetching lua trace from current ctx */
-                       SEND_ERR(NULL, "Lua event_hdl: unexpected error (memory failure?).\n");
-               }
+               trace = hlua_traceback(hlua_sub->hlua->T, ", ");
+
                ha_warning("Lua event_hdl: pausing the subscription because the handler fails "
                           "to keep up the pace (%u unconsumed events) from %s.\n",
-                          event_hdl_async_equeue_size(&hlua_sub->equeue),
-                          (trace) ? trace : "[unknown]");
+                          event_hdl_async_equeue_size(&hlua_sub->equeue), trace);
        }
 
        if (HLUA_IS_RUNNING(hlua_sub->hlua)) {