From: Bertrand Jacquin Date: Thu, 21 Jan 2021 01:31:46 +0000 (+0000) Subject: BUG/MINOR: mworker: define _GNU_SOURCE for strsignal() X-Git-Tag: v2.4-dev6~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25439de1811aeda7bf472f70f40c3fac9725907e;p=thirdparty%2Fhaproxy.git BUG/MINOR: mworker: define _GNU_SOURCE for strsignal() glibc < 2.10 requires _GNU_SOURCE in order to make use of strsignal(), otherwise leading to SEGV at runtime. $ make V=1 TARGET=linux-glibc-legacy USE_THREAD= USE_ACCEPT4= .. src/mworker.c: In function 'mworker_catch_sigchld': src/mworker.c:285: warning: implicit declaration of function 'strsignal' src/mworker.c:285: warning: pointer/integer type mismatch in conditional expression .. $ make V=1 reg-tests REGTESTS_TYPES=slow,default .. ###### Test case: reg-tests/mcli/mcli_start_progs.vtc ###### ## test results in: "/tmp/haregtests-2021-01-19_15-18-07.n24989/vtc.29077.28f6153d" ---- h1 Bad exit status: 0x008b exit 0x0 signal 11 core 128 ---- h1 Assert error in haproxy_wait(), src/vtc_haproxy.c line 792: Condition(*(&h->fds[1]) >= 0) not true. Errno=0 Success .. $ gdb ./haproxy /tmp/core.0.haproxy.30270 .. Core was generated by `/root/haproxy/haproxy -d -W -S fd@8 -dM -f /tmp/haregtests-2021-01-19_15-18-07.'. Program terminated with signal 11, Segmentation fault. #0 0x00002aaaab387a10 in strlen () from /lib64/libc.so.6 (gdb) bt #0 0x00002aaaab387a10 in strlen () from /lib64/libc.so.6 #1 0x00002aaaab354b69 in vfprintf () from /lib64/libc.so.6 #2 0x00002aaaab37788a in vsnprintf () from /lib64/libc.so.6 #3 0x00000000004a76a3 in memvprintf (out=0x7fffedc680a0, format=0x5a5d58 "Current worker #%d (%d) exited with code %d (%s)\n", orig_args=0x7fffedc680d0) at src/tools.c:3868 #4 0x00000000004bbd40 in print_message (label=0x58abed "ALERT", fmt=0x5a5d58 "Current worker #%d (%d) exited with code %d (%s)\n", argp=0x7fffedc680d0) at src/log.c:1066 #5 0x00000000004bc07f in ha_alert (fmt=0x5a5d58 "Current worker #%d (%d) exited with code %d (%s)\n") at src/log.c:1109 #6 0x0000000000534b7b in mworker_catch_sigchld (sh=) at src/mworker.c:293 #7 0x0000000000556af3 in __signal_process_queue () at src/signal.c:88 #8 0x00000000004f6216 in signal_process_queue () at include/haproxy/signal.h:39 #9 run_poll_loop () at src/haproxy.c:2859 #10 0x00000000004f63b7 in run_thread_poll_loop (data=) at src/haproxy.c:3028 #11 0x00000000004faaac in main (argc=, argv=0x7fffedc68498) at src/haproxy.c:904 See: https://man7.org/linux/man-pages/man3/strsignal.3.html Must be backported as far as 2.0. --- diff --git a/src/mworker.c b/src/mworker.c index 690f3f0257..abdc1d3893 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -10,6 +10,8 @@ * */ +#define _GNU_SOURCE + #include #include #include