haproxy/contrib
William Dauchy baf2273345 BUG/MEDIUM: contrib/prometheus-exporter: fix segfault in listener name dump
We need to check whether listener is empty before doing anything; in
that case, we were trying to dump listerner name while name is null. So
simply move the counters check above, which validate all possible cases
when the listener is empty. This is very similar to what is done in
stats.c

see also the trace:

  Thread 1 "haproxy" received signal SIGSEGV, Segmentation fault.
  __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120
  120     ../sysdeps/x86_64/multiarch/../strlen.S: No such file or directory.
  (gdb) bt
  #0  __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120
  #1  0x00005555555b716b in promex_dump_listener_metrics (htx=0x5555558fadf0, appctx=0x555555926070) at contrib/prometheus-exporter/service-prometheus.c:722
  #2  promex_dump_metrics (htx=0x5555558fadf0, si=0x555555925920, appctx=0x555555926070) at contrib/prometheus-exporter/service-prometheus.c:1200
  #3  promex_appctx_handle_io (appctx=0x555555926070) at contrib/prometheus-exporter/service-prometheus.c:1477
  #4  0x00005555556f0c94 in task_run_applet (t=0x555555926180, context=0x555555926070, state=<optimized out>) at src/applet.c:88
  #5  0x00005555556bc6d8 in run_tasks_from_lists (budgets=budgets@entry=0x7fffffffe374) at src/task.c:548
  #6  0x00005555556bd1a0 in process_runnable_tasks () at src/task.c:750
  #7  0x0000555555696cdd in run_poll_loop () at src/haproxy.c:2870
  #8  0x0000555555697025 in run_thread_poll_loop (data=data@entry=0x0) at src/haproxy.c:3035
  #9  0x0000555555596c90 in main (argc=<optimized out>, argv=0x7fffffffe818) at src/haproxy.c:3723
  quit)

this bug was introduced by commit
e3f7bd5ae9 ("MEDIUM:
contrib/prometheus-exporter: add listen stats"), which is present for
2.4 only, so no backport needed.

Signed-off-by: William Dauchy <wdauchy@gmail.com>
2021-02-25 07:14:08 +01:00
..
51d/src BUILD/MINOR: 51d: Updated build registration output to indicate thatif the library is a dummy one or not. 2019-06-13 18:00:54 +02:00
base64
debug CONTRIB: debug: address "poll" utility build on non-linux platforms 2020-12-21 08:45:26 +01:00
deviceatlas CONTRIB: da: fix memory leak in dummy function da_atlas_open() 2020-07-12 09:12:07 +02:00
halog CONTRIB: halog: fix signed/unsigned build warnings on counts and timestamps 2020-12-21 08:43:09 +01:00
hpack REORG: include: move hpack*.h to haproxy/ and split hpack-tbl 2020-06-11 10:18:57 +02:00
ip6range
iprange
mod_defender CLEANUP: Apply the coccinelle patch for `XXXcmp()` on contrib/ 2021-01-04 10:09:02 +01:00
modsecurity CLEANUP: Apply the coccinelle patch for `XXXcmp()` on contrib/ 2021-01-04 10:09:02 +01:00
netsnmp-perl
opentracing CLEANUP: assorted typo fixes in the code and comments 2020-12-21 11:24:48 +01:00
plug_qdisc CLEANUP: assorted typo fixes in the code and comments 2020-03-31 17:09:35 +02:00
prometheus-exporter BUG/MEDIUM: contrib/prometheus-exporter: fix segfault in listener name dump 2021-02-25 07:14:08 +01:00
release-estimator CONTRIB: release-estimator: Add release estimating tool 2020-10-24 12:27:17 +02:00
selinux
spoa_example CLEANUP: Apply the coccinelle patch for `XXXcmp()` on contrib/ 2021-01-04 10:09:02 +01:00
spoa_server BUG/MEDIUM: spoa/python: Fixing references to None 2020-12-09 08:39:31 +01:00
syntax-highlight MEDIUM: Make '(cli|con|srv)timeout' directive fatal 2019-06-17 13:35:54 +02:00
systemd BUG/MINOR: systemd: Wait for network to be online 2020-06-19 21:31:10 +02:00
tcploop CONTRIB: tcploop: remove unused local variables in tcp_pause() 2020-10-22 05:17:08 +02:00
trace
wireshark-dissectors/peers MINOR: contrib: Make the wireshark peers dissector compile for more distribs. 2021-01-19 15:22:35 +01:00
wurfl CLEANUP: assorted typo fixes in the code and comments 2020-03-31 17:09:35 +02:00