BUILD: debug: silence a build warning with threads disabled

Commit 091de0f9b2 ("MINOR: debug: slightly change the thread_dump_pointer
signification") caused the following warning to be emitted when threads
are disabled:

  src/debug.c: In function 'ha_thread_dump_one':
  src/debug.c:359:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Let's just disguise the pointer to silence it. It should be backported
where the patch above was backported, since it was part of a series aiming
at making thread dumps more exploitable from core dumps.

(cherry picked from commit f163cbfb7f893a06d158880a753cad01908143d8)
[wt: s/MT_LIST_FOR_EACH_ENTRY_LOCKED/mt_list_for_each_entry_safe/ with
     two backup elements in 3.0]
Signed-off-by: Willy Tarreau <w@1wt.eu>
This commit is contained in:
Willy Tarreau 2024-10-24 15:04:25 +02:00
parent 38c874bad6
commit 9ec0260698
2 changed files with 3 additions and 3 deletions

View File

@ -2708,7 +2708,7 @@ int check_config_validity()
struct proxy *init_proxies_list = NULL;
struct stktable *t;
struct server *newsrv = NULL;
struct mt_list back;
struct mt_list *back1, back2;
int err_code = 0;
unsigned int next_pxid = 1;
struct bind_conf *bind_conf;
@ -4130,7 +4130,7 @@ out_uri_auth_compat:
/* we must finish to initialize certain things on the servers */
MT_LIST_FOR_EACH_ENTRY_LOCKED(newsrv, &servers_list, global_list, back) {
mt_list_for_each_entry_safe(newsrv, &servers_list, global_list, back1, back2) {
/* initialize idle conns lists */
if (srv_init_per_thr(newsrv) == -1) {
ha_alert("parsing [%s:%d] : failed to allocate per-thread lists for server '%s'.\n",

View File

@ -327,7 +327,7 @@ void ha_thread_dump_one(int thr, int from_signal)
}
leave:
/* end of dump, setting the buffer to 0x1 will tell the caller we're done */
HA_ATOMIC_OR((ulong*)&ha_thread_ctx[thr].thread_dump_buffer, 0x1UL);
HA_ATOMIC_OR((ulong*)DISGUISE(&ha_thread_ctx[thr].thread_dump_buffer), 0x1UL);
}
/* Triggers a thread dump from thread <thr>, either directly if it's the