From: Willy Tarreau Date: Thu, 6 Aug 2026 07:25:13 +0000 (+0200) Subject: BUG/MINOR: stats-file: reject tgid 0 when preloading shm objects X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e75361765195646a03772e2d7c1789a5deaac836;p=thirdparty%2Fhaproxy.git BUG/MINOR: stats-file: reject tgid 0 when preloading shm objects When preloading the shared memory stats file at startup, shm_stats_file_preload() only checked that the tgid read from each object was not greater than the number of configured thread groups, but it forgot to also check for zero, which can correspond to an entry in the process of being reused, and that would cause the process to crash on startup. Let's just also test 0. This should be backported to 3.3. Reported-by: Claude (ANT-2026-71A0JC6Q) --- diff --git a/src/stats-file.c b/src/stats-file.c index 7988f3bb9..761f0d2cc 100644 --- a/src/stats-file.c +++ b/src/stats-file.c @@ -766,8 +766,8 @@ static void shm_stats_file_preload(void) obj_tgid = HA_ATOMIC_LOAD(&curr_obj->tgid); - /* ignore object if greater than our max tgid */ - if (obj_tgid <= global.nbtgroups && + /* ignore object if tgid greater than our max tgid (or null) */ + if (obj_tgid && obj_tgid <= global.nbtgroups && (node = guid_lookup(curr_obj->guid))) { switch (*node->obj_type) { case OBJ_TYPE_LISTENER: