]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: dns: multi-thread concurrency issue on UDP socket
authorEmeric Brun <ebrun@haproxy.com>
Tue, 10 May 2022 09:35:48 +0000 (11:35 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Wed, 11 May 2022 13:20:10 +0000 (15:20 +0200)
commit314e6ec8224e3636d019502286ec46ab418a6e9b
tree2795ff385772dcd3877e75fae0079e5026758b10
parent47a4c61d636fc8fa63f0247a735075c1872c701d
BUG/MAJOR: dns: multi-thread concurrency issue on UDP socket

This patch adds a lock on the struct dgram_conn to ensure
that an other thread cannot trash a fd or alter its status
while the current thread processing it on for send/receive/connect
operations.

Starting with the 2.4 version this could cause a crash when a DNS
request is failing, setting the FD of the dgram structure to -1. If the
dgram structure is reused after that, a read access to fdtab[-1] is
attempted. The crash was only triggered when compiled with ASAN.

In previous versions the concurrency issue also exists but is less
likely to crash.

This patch must be backported until v2.4 and should be
adapt for v < 2.4.
include/haproxy/dgram-t.h
src/dns.c