[asan] new run-time flag: sleep_before_dying (asan Issue #31)
llvm-svn: 149306
This commit is contained in:
parent
5d0d607b6b
commit
bca91defcb
|
|
@ -166,6 +166,7 @@ extern bool FLAG_use_fake_stack;
|
|||
extern size_t FLAG_max_malloc_fill_size;
|
||||
extern int FLAG_exitcode;
|
||||
extern bool FLAG_allow_user_poisoning;
|
||||
extern int FLAG_sleep_before_dying;
|
||||
extern bool FLAG_handle_segv;
|
||||
|
||||
extern int asan_inited;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ void AsanDisableCoreDumper() {
|
|||
}
|
||||
|
||||
void AsanDie() {
|
||||
if (FLAG_sleep_before_dying) {
|
||||
Report("Sleeping for %d second(s)\n", FLAG_sleep_before_dying);
|
||||
sleep(FLAG_sleep_before_dying);
|
||||
}
|
||||
_exit(FLAG_exitcode);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ size_t FLAG_max_malloc_fill_size = 0;
|
|||
bool FLAG_use_fake_stack;
|
||||
int FLAG_exitcode = EXIT_FAILURE;
|
||||
bool FLAG_allow_user_poisoning;
|
||||
int FLAG_sleep_before_dying;
|
||||
|
||||
// -------------------------- Globals --------------------- {{{1
|
||||
int asan_inited;
|
||||
|
|
@ -411,6 +412,7 @@ void __asan_init() {
|
|||
FLAG_exitcode = IntFlagValue(options, "exitcode=", EXIT_FAILURE);
|
||||
FLAG_allow_user_poisoning = IntFlagValue(options,
|
||||
"allow_user_poisoning=", 1);
|
||||
FLAG_sleep_before_dying = IntFlagValue(options, "sleep_before_dying=", 0);
|
||||
|
||||
if (FLAG_atexit) {
|
||||
atexit(asan_atexit);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@ $CC -g -faddress-sanitizer -O2 $C_TEST.c -pie
|
|||
./a.out 2>&1 | grep "heap-use-after-free" > /dev/null
|
||||
rm ./a.out
|
||||
|
||||
echo "Testing sleep_before_dying"
|
||||
$CC -g -faddress-sanitizer -O2 $C_TEST.c
|
||||
ASAN_OPTIONS=sleep_before_dying=1 ./a.out 2>&1 | grep "Sleeping for 1 second" > /dev/null
|
||||
rm a.out
|
||||
|
||||
for t in *.tmpl; do
|
||||
for b in 32 64; do
|
||||
for O in 0 1 2 3; do
|
||||
|
|
|
|||
Loading…
Reference in New Issue