From: Willy Tarreau Date: Fri, 15 Jul 2022 17:38:52 +0000 (+0200) Subject: BUG/MINOR: threads: produce correct global mask for tgroup > 1 X-Git-Tag: v2.7-dev2~53 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b0f0d146f406bffa611d60d3779eb9442c361d3;p=thirdparty%2Fhaproxy.git BUG/MINOR: threads: produce correct global mask for tgroup > 1 In thread_resolve_group_mask(), if a global thread number is passed and it belongs to a group greater than 1, an incorrect shift resulted in shifting that ID again which made it appear nowhere or in a wrong group possibly. The bug was introduced in 2.5 with commit 627def9e5 ("MINOR: threads: add a new function to resolve config groups and masks") though the groups only starts to be usable in 2.7, so there is no impact for this bug, hence no backport is needed. --- diff --git a/src/thread.c b/src/thread.c index 28cfa9de09..1cf0a746f6 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1156,7 +1156,7 @@ int thread_resolve_group_mask(uint igid, ulong imask, uint *ogid, ulong *omask, /* we have a valid group, convert this to global thread IDs */ *ogid = igid; - *omask = imask << ha_tgroup_info[igid - 1].base; + *omask = imask & (ha_tgroup_info[igid - 1].threads_enabled << ha_tgroup_info[igid - 1].base); return 0; } } else {