From: Willy Tarreau Date: Fri, 14 May 2021 06:26:38 +0000 (+0200) Subject: BUG/MAJOR: config: properly initialize cpu_map.thread[] up to MAX_THREADS X-Git-Tag: v2.4.0~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=26f42a07793f7f5fa5dfee3421ded68a5c1284d9;p=thirdparty%2Fhaproxy.git BUG/MAJOR: config: properly initialize cpu_map.thread[] up to MAX_THREADS A mistake was introduced in 2.4-dev17 by commit 982fb5339 ("MEDIUM: config: use platform independent type hap_cpuset for cpu-map"), it initializes cpu_map.thread[] from 0 to MAX_PROCS-1 instead of MAX_THREADS-1 resulting in crashes when the two differ, e.g. when building with USE_THREAD= but still with USE_CPU_AFFINITY=1. No backport is needed. --- diff --git a/src/haproxy.c b/src/haproxy.c index 1fd4a6be66..71866eb17d 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1778,6 +1778,8 @@ static void init(int argc, char **argv) for (i = 0; i < MAX_PROCS; ++i) { ha_cpuset_zero(&cpu_map.proc[i]); ha_cpuset_zero(&cpu_map.proc_t1[i]); + } + for (i = 0; i < MAX_THREADS; ++i) { ha_cpuset_zero(&cpu_map.thread[i]); } }