]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: debug: silence a build warning with threads disabled
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Oct 2024 13:04:25 +0000 (15:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Oct 2024 14:12:46 +0000 (16:12 +0200)
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.

src/debug.c

index 49049f6dc00ce3f58e84ccd4c07425a13ee7d819..0d569d6c88e420d4038bd833d67db0490bc2e728 100644 (file)
@@ -348,7 +348,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