]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: makefile: enable backtrace by default on musl
authorWilly Tarreau <w@1wt.eu>
Thu, 17 Apr 2025 14:11:14 +0000 (16:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 17 Apr 2025 14:25:47 +0000 (16:25 +0200)
The reason musl builds was not producing exploitable backtraces was
that the toolchain used appears to automatically omit the frame pointer
at -O2 but leaves it at -O0. This patch just makes sure to always append
-fno-omit-frame-pointer to the BACKTRACE cflags and enables the option
with musl where it now works. This will allow us to finally get
exploitable traces from docker images where core dumps are not always
available.

Makefile

index b87a0af7d04d0f85fdbb37e3ea8a29d4c3a8c39b..768d840f37ec6d9e3474cbc6ce09356ed26a8a38 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -401,7 +401,7 @@ ifeq ($(TARGET),linux-musl)
     USE_POLL USE_TPROXY USE_LIBCRYPT USE_DL USE_RT USE_CRYPT_H USE_NETFILTER  \
     USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY USE_LINUX_CAP      \
     USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO     \
-    USE_GETADDRINFO)
+    USE_GETADDRINFO USE_BACKTRACE)
   INSTALL = install -v
 endif
 
@@ -592,6 +592,7 @@ endif
 
 ifneq ($(USE_BACKTRACE:0=),)
   BACKTRACE_LDFLAGS = -Wl,$(if $(EXPORT_SYMBOL),$(EXPORT_SYMBOL),--export-dynamic)
+  BACKTRACE_CFLAGS  = -fno-omit-frame-pointer
 endif
 
 ifneq ($(USE_CPU_AFFINITY:0=),)