BUG/MAJOR: segfault using multiple log forward sections. next
authorEmeric Brun <ebrun@haproxy.com>
Wed, 1 Dec 2021 11:08:42 +0000 (12:08 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 2 Dec 2021 14:26:41 +0000 (15:26 +0100)
commit10c8dfc4252a239102ab1ac698b6cda49c368c71
treee20c3312a209a5e4c0b91687704fd4dc723013a7
parentdb249aa7b802363e1a98c9901e4ecdc35f9025e8
BUG/MAJOR: segfault using multiple log forward sections.

For each new log forward section, the proxy was added to the log forward
proxy list but the ref on the previous log forward section's proxy was
scratched using "init_new_proxy" which performs a memset. After configuration
parsing this list contains only the last section's proxy.

The post processing walk through this list to resolve "ring" names.
Since some section's proxies are missing in this list, the resolving
is not done for those ones and the pointer on the ring is kept to null
causing a segfault at runtime trying to write a log message
into the ring.

This patch shift the "init_new_proxy" before adding the ref on the
previous log forward section's proxy on currently parsed one.

This patch shoud fix github issue #1464

This patch should be backported to 2.3

(cherry picked from commit 2ad2b1c94cc7bb88b879fb0895a3bee566fdf053)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit e58cefb519056c2299b1b14c9e598c312c65848f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 9ecb3bc2a642e676b6239f07bd837cf14b202f82)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/log.c