]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: hlua: Forbid lua-load with per-tgroup fd tables
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 19 Aug 2026 14:10:50 +0000 (16:10 +0200)
committerOlivier Houchard <cognet@ci0.org>
Wed, 19 Aug 2026 14:27:42 +0000 (16:27 +0200)
lua-load may be used to create file descriptors that it expects to be
global to the process, which is not true file tune.fd.tables
per-thread-group, so forbid it.

src/hlua.c

index 1958da548d5e454c4f5e64eb3a1870b1e403f9bb..1882db98ab1e5a7503298040b1b99c49362107ac 100644 (file)
@@ -12991,6 +12991,7 @@ static int hlua_load_state(char **args, lua_State *L, char **err)
        return 0;
 }
 
+static int hlua_gload = 0;
 static int hlua_load(char **args, int section_type, struct proxy *curpx,
                      const struct proxy *defpx, const char *file, int line,
                      char **err)
@@ -13005,6 +13006,7 @@ static int hlua_load(char **args, int section_type, struct proxy *curpx,
        /* loading for global state */
        hlua_state_id = 0;
        ha_set_thread(NULL);
+       hlua_gload = 1;
        return hlua_load_state(&args[1], hlua_states[0], err);
 }
 
@@ -13531,6 +13533,11 @@ int hlua_post_init()
        }
 #endif
 
+       if (hlua_gload && (global.tune.options & GTUNE_NO_TG_FD_SHARING) &&
+           global.nbtgroups > 1) {
+               ha_alert("tune.fd.tables per-thread-groups is incompatible with lua-load, please use lua-load-per-thread");
+               return 0;
+       }
        /* Perform post init of common thread */
        hlua_state_id = 0;
        ha_set_thread(&ha_thread_info[0]);