haproxy public development tree
Go to file
Willy Tarreau c9036c0004 BUG/MAJOR: cache: fix confusion between zero and uninitialized cache key
The cache uses the first 32 bits of the uri's hash as the key to reference
the object in the cache. It makes a special case of the value zero to mean
that the object is not in the cache anymore. The problem is that when an
object hashes as zero, it's still inserted but the eb32_delete() call is
skipped, resulting in the object still being chained in the memory area
while the block has been reclaimed and used for something else. Then when
objects which were chained below it (techically any object since zero is
at the root) are deleted, the walk through the upper object may encounter
corrupted values where valid pointers were expected.

But while this should only happen statically once on 4 billion, the problem
gets worse when the cache-use conditions don't match the cache-store ones,
because cache-store runs with an uninitialized key, which can create objects
that will never be found by the lookup code, or worse, entries with a zero
key preventing eviction of the tree node and resulting in a crash. It's easy
to accidently end up on such a config because the request rules generally
can't be used to decide on the response :

  http-request  cache-use cache   if { path_beg /images }
  http-response cache-store cache

In this test, mixing traffic with /images/$RANDOM and /foo/$RANDOM will
result in random keys being inserted, some of them possibly being zero,
and crashes will quickly happen.

The fix consists in 1) always initializing the transaction's cache_hash
to zero, and 2) never storing a response for which the hash has not been
calculated, as indicated by the value zero.

It is worth noting that objects hashing as value zero will never be cached,
but given that there's only one chance among 4 billion that this happens,
this is totally harmless.

This fix must be backported to 1.9 and 1.8.
2019-01-14 10:31:31 +01:00
contrib CONTRIB: debug: report stream-int's flag SI_FL_CLEAN_ABRT 2018-12-18 11:03:11 +01:00
doc DOC: Be a bit more explicit about allow-0rtt security implications. 2019-01-09 16:26:33 +01:00
ebtree CLEANUP: fix typos in comments in ebtree 2018-11-18 22:23:15 +01:00
examples [RELEASE] Released version 2.0-dev0 2018-12-22 11:20:35 +01:00
include BUG/MEDIUM: connection: properly unregister the mux on failed initialization 2019-01-10 19:47:43 +01:00
reg-tests REGTEST: filters: add compression test 2019-01-09 14:36:22 +01:00
scripts REGTEST: Add some informatoin to test results. 2019-01-08 11:43:35 +01:00
src BUG/MAJOR: cache: fix confusion between zero and uninitialized cache key 2019-01-14 10:31:31 +01:00
tests CLEANUP: fix a misspell in tests/filltab25.c 2018-11-18 22:23:15 +01:00
.gitignore DOC: split the README into README + INSTALL 2018-12-16 22:30:57 +01:00
CHANGELOG [RELEASE] Released version 2.0-dev0 2018-12-22 11:20:35 +01:00
CONTRIBUTING DOC: Fix typos in README and CONTRIBUTING 2018-11-12 08:54:12 +01:00
INSTALL [RELEASE] Released version 2.0-dev0 2018-12-22 11:20:35 +01:00
LICENSE
MAINTAINERS DOC: fix reference to map files in MAINTAINERS 2018-10-17 04:21:04 +02:00
Makefile BUILD: makefile: add an EXTRA_OBJS variable to help build optional code 2019-01-10 10:01:03 +01:00
README DOC: split the README into README + INSTALL 2018-12-16 22:30:57 +01:00
ROADMAP
SUBVERS
VERDATE [RELEASE] Released version 2.0-dev0 2018-12-22 11:20:35 +01:00
VERSION [RELEASE] Released version 2.0-dev0 2018-12-22 11:20:35 +01:00

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
  - 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)