mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-31 17:12:05 +00:00
BUILD: pools: make DEBUG_MEMORY_POOLS=1 the default option
This option has been set by default for a very long time and also complicates the manipulation of the DEBUG variable. Let's make it the official default and permit to unset it by setting it to zero. The other pool-related DEBUG options were adjusted to also explicitly check for the zero value for consistency.
This commit is contained in:
parent
b70981532a
commit
772f9a5874
17
INSTALL
17
INSTALL
@ -691,7 +691,7 @@ these options should not be changed. Among the usable ones are:
|
||||
overflows, which may have security implications. The cost is extremely low
|
||||
(less than 1% increase in memory footprint). This is equivalent to adding
|
||||
"-dMtag" on the command line. This option is enabled in the default build
|
||||
options.
|
||||
options and may be disabled with -DDEBUG_MEMORY_POOLS=0.
|
||||
|
||||
- -DDEBUG_DONT_SHARE_POOLS: this will keep separate pools for same-sized
|
||||
objects of different types. Using this increases the memory usage a little
|
||||
@ -711,12 +711,13 @@ these options should not be changed. Among the usable ones are:
|
||||
are encouraged to use it, in combination with -DDEBUG_DONT_SHARE_POOLS and
|
||||
-DDEBUG_MEMORY_POOLS, as this could catch dangerous regressions.
|
||||
|
||||
As such, for regular production, "-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS" is
|
||||
recommended. For security sensitive environments, it is recommended to use
|
||||
"-DDEBUG_STRICT -DDEBUG_STRICT_ACTION=2 -DDEBUG_MEMORY_POOLS \
|
||||
-DDEBUG_DONT_SHARE_POOLS". For deployments dedicated to testing new versions or
|
||||
when trying to nail a bug down, use "-DDEBUG_STRICT=2 -DDEBUG_STRICT_ACTION=2 \
|
||||
-DDEBUG_MEMORY_POOLS -DDEBUG_DONT_SHARE_POOLS -DDEBUG_POOL_INTEGRITY".
|
||||
As such, "-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS" is implicit and recommended for
|
||||
production. For security sensitive environments, it is recommended to use
|
||||
"-DDEBUG_STRICT_ACTION=2 -DDEBUG_DONT_SHARE_POOLS". When testing new versions
|
||||
or trying to nail a bug down, use "-DDEBUG_STRICT=2 -DDEBUG_STRICT_ACTION=2 \
|
||||
-DDEBUG_DONT_SHARE_POOLS -DDEBUG_POOL_INTEGRITY". Finally in order to minimize
|
||||
memory usage by disabling these integrity features, it is also possible to use
|
||||
"-DDEBUG_STRICT=0 -DDEBUG_MEMORY_POOLS=0".
|
||||
|
||||
The DEP variable is automatically set to the list of include files and also
|
||||
designates a file that contains the last build options used. It is used during
|
||||
@ -757,7 +758,7 @@ example :
|
||||
If you need to pass some defines to the preprocessor or compiler, you may pass
|
||||
them all in the DEFINE variable. Example:
|
||||
|
||||
$ make TARGET=generic DEFINE="-DDEBUG_DONT_SHARE_POOLS -DDEBUG_MEMORY_POOLS"
|
||||
$ make TARGET=generic DEFINE="-DDEBUG_DONT_SHARE_POOLS"
|
||||
|
||||
The ADDINC variable may be used to add some extra include paths; this is
|
||||
sometimes needed when cross-compiling. Similarly the ADDLIB variable may be
|
||||
|
2
Makefile
2
Makefile
@ -228,7 +228,7 @@ SMALL_OPTS =
|
||||
# DEBUG_NO_POOLS, DEBUG_FAIL_ALLOC, DEBUG_STRICT_ACTION=[0-3], DEBUG_HPACK,
|
||||
# DEBUG_AUTH, DEBUG_SPOE, DEBUG_UAF, DEBUG_THREAD, DEBUG_STRICT, DEBUG_DEV,
|
||||
# DEBUG_TASK, DEBUG_MEMORY_POOLS, DEBUG_POOL_TRACING, DEBUG_QPACK, DEBUG_LIST.
|
||||
DEBUG = -DDEBUG_MEMORY_POOLS
|
||||
DEBUG =
|
||||
|
||||
#### Trace options
|
||||
# Use TRACE=1 to trace function calls to file "trace.out" or to stderr if not
|
||||
|
@ -561,4 +561,8 @@
|
||||
# define DEBUG_STRICT 1
|
||||
#endif
|
||||
|
||||
#if !defined(DEBUG_MEMORY_POOLS)
|
||||
# define DEBUG_MEMORY_POOLS 1
|
||||
#endif
|
||||
|
||||
#endif /* _HAPROXY_DEFAULTS_H */
|
||||
|
19
src/pool.c
19
src/pool.c
@ -40,31 +40,30 @@ static struct list pools __read_mostly = LIST_HEAD_INIT(pools);
|
||||
int mem_poison_byte __read_mostly = 'P';
|
||||
int pool_trim_in_progress = 0;
|
||||
uint pool_debugging __read_mostly = /* set of POOL_DBG_* flags */
|
||||
#ifdef DEBUG_FAIL_ALLOC
|
||||
#if defined(DEBUG_FAIL_ALLOC) && (DEBUG_FAIL_ALLOC > 0)
|
||||
POOL_DBG_FAIL_ALLOC |
|
||||
#endif
|
||||
#ifdef DEBUG_DONT_SHARE_POOLS
|
||||
#if defined(DEBUG_DONT_SHARE_POOLS) && (DEBUG_DONT_SHARE_POOLS > 0)
|
||||
POOL_DBG_DONT_MERGE |
|
||||
#endif
|
||||
#ifdef DEBUG_POOL_INTEGRITY
|
||||
#if defined(DEBUG_POOL_INTEGRITY) && (DEBUG_POOL_INTEGRITY > 0)
|
||||
POOL_DBG_COLD_FIRST |
|
||||
#endif
|
||||
#ifdef DEBUG_POOL_INTEGRITY
|
||||
POOL_DBG_INTEGRITY |
|
||||
#endif
|
||||
#ifdef CONFIG_HAP_NO_GLOBAL_POOLS
|
||||
#if defined(CONFIG_HAP_NO_GLOBAL_POOLS)
|
||||
POOL_DBG_NO_GLOBAL |
|
||||
#endif
|
||||
#if defined(DEBUG_NO_POOLS) || defined(DEBUG_UAF)
|
||||
#if defined(DEBUG_NO_POOLS) && (DEBUG_NO_POOLS > 0)
|
||||
POOL_DBG_NO_CACHE |
|
||||
#endif
|
||||
#if defined(DEBUG_POOL_TRACING)
|
||||
#if defined(DEBUG_POOL_TRACING) && (DEBUG_POOL_TRACING > 0)
|
||||
POOL_DBG_CALLER |
|
||||
#endif
|
||||
#if defined(DEBUG_MEMORY_POOLS)
|
||||
#if defined(DEBUG_MEMORY_POOLS) && (DEBUG_MEMORY_POOLS > 0)
|
||||
POOL_DBG_TAG |
|
||||
#endif
|
||||
#if defined(DEBUG_UAF)
|
||||
#if defined(DEBUG_UAF) && (DEBUG_UAF > 0)
|
||||
POOL_DBG_NO_CACHE |
|
||||
POOL_DBG_UAF |
|
||||
#endif
|
||||
0;
|
||||
|
Loading…
Reference in New Issue
Block a user