]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: ssl: Fix unprotected 'ssl_sock_choose_sni_ctx' calls
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Mon, 17 Aug 2026 13:26:24 +0000 (15:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 17 Aug 2026 17:15:12 +0000 (19:15 +0200)
commite80bcb3eacbec961c90cd471fda9ce610d769a07
treec956e9e357842ac8b4bea6a5684368565b4edbf7
parent998c8280d4b55db3895b55a41cd703beb28b7fe6
BUG/MEDIUM: ssl: Fix unprotected 'ssl_sock_choose_sni_ctx' calls

The 'ssl_sock_choose_sni_ctx' function accesses the sni tree and it
mostly covered by a read/write lock which was not taken around two of
its uses. One of them could be reached by using the SSL-related CLI
commands and the other one when the generate-cert mechanism is used. So
even if it's in a not that common use case, a race could still happen
and end up crashing.

Note that this requires that the read lock is properly released
before calling ssl_sock_generate_certificate() so as to avoid a
possible read-lock recursion (it was verified that this is safe).

This patch should be backported up to 3.0.

Reported-by: Claude (ANT-2026-VFR5JH3R)
src/ssl_clienthello.c
src/ssl_gencert.c
src/ssl_sock.c