Skip to content

Commit

Permalink
src: do not report speculative overflows within ASan RTL
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksiiOleksenko committed Feb 20, 2020
1 parent c296d73 commit 79637f6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion postprocessing/analyzer.py
Expand Up @@ -499,7 +499,8 @@ def get_key(address):
k = l[0]

if "asan" in k or "sanitizer" in k:
raise RuntimeError("Detected an exception in ASan runtime library: " + k)
raise RuntimeError(
"Detected an exception in ASan runtime library: " + k + " at " + address)

return k, l

Expand Down
5 changes: 5 additions & 0 deletions src/specfuzz_init.c
Expand Up @@ -71,6 +71,11 @@ void specfuzz_handler(int signo, siginfo_t *siginfo, void *ucontext) {

if (siginfo->si_signo == SIGFPE) {
STAT_INCREMENT(stat_signal_misc);
} else if (context->uc_mcontext.gregs[REG_RSP] >= (long long) &asan_rtl_frame_bottom &&
context->uc_mcontext.gregs[REG_RSP] <= (long long) &asan_rtl_frame) {
// When we detect an overflow in ASan RTL, recovering the offending address is tricky
// For the time being, we ignore these cases
STAT_INCREMENT(stat_signal_overflow);
} else {
#if ENABLE_PRINT == 1
// Print information about the signal
Expand Down
3 changes: 3 additions & 0 deletions src/specfuzz_rtl.S
Expand Up @@ -140,6 +140,7 @@ specfuzz_rtl_frame: .quad 0

// A disjoint stack frame for ASan functions
.globl asan_rtl_frame
.globl asan_rtl_frame_bottom
asan_rtl_frame_bottom: .zero 4088
asan_rtl_frame: .quad 0

Expand Down Expand Up @@ -729,6 +730,7 @@ specfuzz_check_code_pointer:
jl specfuzz_check_code_pointer.ok
cmpq $_end, %rdi # bss and data
jl specfuzz_check_code_pointer.corrupted

specfuzz_check_code_pointer.unknown:
// We are above BSS, which means we are about to either enter a dynamically linked
// code (most likely uninstrumented) or to executes some random data
Expand All @@ -743,6 +745,7 @@ specfuzz_check_code_pointer.unknown:
specfuzz_check_code_pointer.ok:
popfq
ret

specfuzz_check_code_pointer.corrupted:
STAT_INCREMENT stat_corrupted_code_pointer
movq 8(%rsp), %rsi
Expand Down
3 changes: 3 additions & 0 deletions src/specfuzz_rtl.h
Expand Up @@ -20,6 +20,9 @@ extern uint64_t branch_execution_count;
extern uint64_t specfuzz_rtl_frame;
extern uint64_t specfuzz_rtl_frame_bottom;

extern uint64_t asan_rtl_frame;
extern uint64_t asan_rtl_frame_bottom;

extern uint64_t *checkpoint_sp;
extern uint64_t checkpoint_stack;
extern uint64_t checkpoint_stack_bottom;
Expand Down

0 comments on commit 79637f6

Please sign in to comment.