]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: ssl: properly protect SSL cert generation
authorWilly Tarreau <w@1wt.eu>
Thu, 17 May 2018 08:56:47 +0000 (10:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 17 May 2018 08:56:47 +0000 (10:56 +0200)
commit03f4ec47d9ffff629b07dcba9f0f134a7c7e44b2
tree0b500f4caff79fa0a64bd8bf0f82cb4a9c88bae8
parentba20dfc50161ba705a746d54ebc1a0a45c46beab
BUG/MEDIUM: ssl: properly protect SSL cert generation

Commit 821bb9b ("MAJOR: threads/ssl: Make SSL part thread-safe") added
insufficient locking to the cert lookup and generation code : it uses
lru64_lookup(), which will automatically remove and add a list element
to the LRU list. It cannot be simply read-locked.

A long-term improvement should consist in using a lockless mechanism
in lru64_lookup() to safely move the list element at the head. For now
let's simply use a write lock during the lookup. The effect will be
minimal since it's used only in conjunction with automatically generated
certificates, which are much more expensive and rarely used.

This fix must be backported to 1.8.
src/ssl_sock.c