FS-11516 [build-system] Add --enable-pool-sanitizer configure flag. This will make it easier to find memory issues when using address sanitizer. Also added -fstack-protector-strong when using --enable-address-sanitizer.

This commit is contained in:
Chris Rienzo 2018-11-20 16:01:46 +00:00 committed by Andrey Volk
parent 8a809624cb
commit 892f0a289f
2 changed files with 22 additions and 10 deletions

View File

@ -1817,11 +1817,21 @@ AC_ARG_ENABLE(address_sanitizer,
[enable_address_sanitizer="no"]) [enable_address_sanitizer="no"])
if test "${enable_address_sanitizer}" = "yes"; then if test "${enable_address_sanitizer}" = "yes"; then
APR_ADDTO(CFLAGS, -fsanitize=address -fno-omit-frame-pointer) APR_ADDTO(CFLAGS, -fsanitize=address -fno-omit-frame-pointer -fstack-protector-strong)
APR_ADDTO(CXXFLAGS, -fsanitize=address -fno-omit-frame-pointer) APR_ADDTO(CXXFLAGS, -fsanitize=address -fno-omit-frame-pointer -fstack-protector-strong)
APR_ADDTO(LDFLAGS, -fsanitize=address) APR_ADDTO(LDFLAGS, -fsanitize=address)
fi fi
AC_ARG_ENABLE(,
[AC_HELP_STRING([--enable-pool-sanitizer],[build with sanitizer friendly pool behavior])],
[enable_pool_sanitizer="$enable_pool_sanitizer"],
[enable_pool_sanitizer="no"])
if test "${enable_pool_sanitizer}" = "yes"; then
APR_ADDTO(CFLAGS, -DDESTROY_POOLS)
ac_configure_args="$ac_configure_args --enable-pool-debug=yes"
fi
# we never use this, and hard setting it will make cross compile work better # we never use this, and hard setting it will make cross compile work better
ac_cv_file_dbd_apr_dbd_mysql_c=no ac_cv_file_dbd_apr_dbd_mysql_c=no

View File

@ -507,6 +507,16 @@ static void free_proc_chain(struct process_chain *procs);
static void pool_destroy_debug(apr_pool_t *pool, const char *file_line); static void pool_destroy_debug(apr_pool_t *pool, const char *file_line);
#endif #endif
#if APR_HAS_THREADS
APR_DECLARE(void) apr_pool_mutex_set(apr_pool_t *pool,
apr_thread_mutex_t *mutex)
{
pool->user_mutex = mutex;
}
#endif
#if !APR_POOL_DEBUG #if !APR_POOL_DEBUG
/* /*
* Initialization * Initialization
@ -729,14 +739,6 @@ APR_DECLARE(void) apr_pool_clear(apr_pool_t *pool)
#endif #endif
} }
#if APR_HAS_THREADS
APR_DECLARE(void) apr_pool_mutex_set(apr_pool_t *pool,
apr_thread_mutex_t *mutex)
{
pool->user_mutex = mutex;
}
#endif
APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool) APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool)
{ {
apr_memnode_t *active; apr_memnode_t *active;