Fix test config of lg_san_uaf_align.

The option may be configure-disabled, which resulted in the invalid options
output from the tests.
This commit is contained in:
Qi Wang 2021-12-30 13:27:23 -08:00 committed by Qi Wang
parent eabe889162
commit d660683d3d
5 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,11 @@
#if defined(JEMALLOC_UAF_DETECTION) || defined(JEMALLOC_DEBUG)
# define TEST_SAN_UAF_ALIGN_ENABLE "lg_san_uaf_align:12"
# define TEST_SAN_UAF_ALIGN_DISABLE "lg_san_uaf_align:-1"
#else
# define TEST_SAN_UAF_ALIGN_ENABLE ""
# define TEST_SAN_UAF_ALIGN_DISABLE ""
#endif
static inline bool static inline bool
extent_is_guarded(tsdn_t *tsdn, void *ptr) { extent_is_guarded(tsdn_t *tsdn, void *ptr) {
edata_t *edata = emap_edata_lookup(tsdn, &arena_emap_global, ptr); edata_t *edata = emap_edata_lookup(tsdn, &arena_emap_global, ptr);

View File

@ -1,4 +1,7 @@
#include "test/jemalloc_test.h" #include "test/jemalloc_test.h"
#include "test/san.h"
const char *malloc_conf = TEST_SAN_UAF_ALIGN_DISABLE;
enum { enum {
alloc_option_start = 0, alloc_option_start = 0,

View File

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
export MALLOC_CONF="tcache_max:1024,lg_san_uaf_align:-1" export MALLOC_CONF="tcache_max:1024"

View File

@ -1,9 +1,13 @@
#include "test/jemalloc_test.h" #include "test/jemalloc_test.h"
#include "test/arena_util.h" #include "test/arena_util.h"
#include "test/san.h"
#include "jemalloc/internal/cache_bin.h" #include "jemalloc/internal/cache_bin.h"
#include "jemalloc/internal/san.h"
#include "jemalloc/internal/safety_check.h" #include "jemalloc/internal/safety_check.h"
const char *malloc_conf = TEST_SAN_UAF_ALIGN_ENABLE;
static size_t san_uaf_align; static size_t san_uaf_align;
static bool fake_abort_called; static bool fake_abort_called;
@ -28,7 +32,7 @@ test_write_after_free_post(void) {
static bool static bool
uaf_detection_enabled(void) { uaf_detection_enabled(void) {
if (!config_uaf_detection) { if (!config_uaf_detection || !san_uaf_detection_enabled()) {
return false; return false;
} }

View File

@ -1,3 +0,0 @@
#!/bin/sh
export MALLOC_CONF="lg_san_uaf_align:12"