mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-14 01:30:54 +00:00
haproxy public development tree
19b016f9f8
When we want to perform some unsafe lua stack manipulations from an unprotected lua environment, we use SET_SAFE_LJMP() RESET_SAFE_LJMP() combination to lock lua stack and catch potential lua exceptions that may occur between the two. Hence, we regularly find this pattern (duplicated over and over): |if (!SET_SAFE_LJMP(hlua)) { | const char *error; | | if (lua_type(hlua->T, -1) == LUA_TSTRING) | error = hlua_tostring_safe(hlua->T, -1); | else | error = "critical error"; | SEND_ERR(NULL, "*: %s.\n", error); |} This is wrong because when SET_SAFE_LJMP() returns false (meaning that an exception was caught), then the lua lock was released already, thus the caller is not expected to perform lua stack manipulations (because the main lua stack may be shared between multiple threads). In the pattern above we only want to retrieve the lua exception message which may be found at the top of the stack, to do so we now explicitly take the lua lock before accessing the lua stack. Note that hlua_lock() doesn't catch lua exceptions so only safe lua functions are expected to be used there (lua functions that may NOT raise exceptions). It should be backported to every stable versions. [ada: some ctx adj will be required for older versions as event_hdl doesn't exist prior to 2.8 and filters were implemented in 2.5, thus some chunks won't apply, but other fixes should stay relevant] |
||
---|---|---|
.github | ||
addons | ||
admin | ||
dev | ||
doc | ||
examples | ||
include | ||
reg-tests | ||
scripts | ||
src | ||
tests | ||
.cirrus.yml | ||
.gitattributes | ||
.gitignore | ||
.mailmap | ||
.travis.yml | ||
BRANCHES | ||
BSDmakefile | ||
CHANGELOG | ||
CONTRIBUTING | ||
INSTALL | ||
LICENSE | ||
MAINTAINERS | ||
Makefile | ||
README | ||
SUBVERS | ||
VERDATE | ||
VERSION |
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)