mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
In _event_hdl_publish(), when publishing an event to async handler(s), async_data is allocated only once and then relies on a refcount logic to reuse the same data block for multiple async event handlers. (this allows to save significant amount of memory) Because the refcount is first set to 0, there is a small race where the consumers could consume async data (async data refcount reaching 0) before publishing is actually over. The consequence is that async data may be freed by one of the consumers while we still rely on it within _event_hdl_publish(). This was discovered by chance when stress-testing the API with multiple async handlers registered to the same event: some of the handlers were notified about a new event for which the event data was already freed, resulting in invalid reads and/or segfaults. To fix this, we first set the refcount to 1, assuming that the publish function relies on async_data until the publish is over. At the end of the publish, the reference to the async data is dropped. This way, async_data is either freed by _event_hdl_publish() itself or by one of the consumers, depending on who is the last one relying on it. If 68e692da0 ("MINOR: event_hdl: add event handler base api") is being backported, then this commit should be backported with it.
The HAProxy documentation has been split into a number of different files for ease of use. Please refer to the following files depending on what you're looking for : - INSTALL for instructions on how to build and install HAProxy - BRANCHES to understand the project's life cycle and what version to use - LICENSE for the project's license - CONTRIBUTING for the process to follow to submit contributions The more detailed documentation is located into the doc/ directory : - doc/intro.txt for a quick introduction on HAProxy - doc/configuration.txt for the configuration's reference manual - doc/lua.txt for the Lua's reference manual - doc/SPOE.txt for how to use the SPOE engine - doc/network-namespaces.txt for how to use network namespaces under Linux - doc/management.txt for the management guide - doc/regression-testing.txt for how to use the regression testing suite - doc/peers.txt for the peers protocol reference - doc/coding-style.txt for how to adopt HAProxy's coding style - doc/internals for developer-specific documentation (not all up to date)
Description
Languages
C
98.1%
Shell
0.8%
Makefile
0.5%
Lua
0.2%
Python
0.2%