diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-06-03 12:36:29 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-06-03 13:22:24 +0000 |
| commit | 04106220bf532bd22d1c36245416d060836aa0a7 (patch) | |
| tree | 1a1fb8f2dfce786264c09c122373d05927b47f9c /executor/executor.cc | |
| parent | 845e65a5b9735429f1336e165f762cba9ce13f71 (diff) | |
executor: fix gvisor signal
Fix 2 bugs:
1. We remove low 12 bits of every PC on amd64 b/c use_cover_edges return true.
This results in extremly low signal (gvisor PC are dense integers).
2. We hash prev/next PC on arm64 which does not make sense
since gvisor coverage is not a trace. This results in falsely large signal.
Diffstat (limited to 'executor/executor.cc')
| -rw-r--r-- | executor/executor.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/executor/executor.cc b/executor/executor.cc index d5420e90c..2fa0c7530 100644 --- a/executor/executor.cc +++ b/executor/executor.cc @@ -1015,11 +1015,11 @@ void write_coverage_signal(cover_t* cov, uint32* signal_count_pos, uint32* cover bool prev_filter = true; for (uint32 i = 0; i < cov->size; i++) { cover_data_t pc = cover_data[i] + cov->pc_offset; - uint64 sig = pc & 0xFFFFFFFFFFFFF000; + uint64 sig = pc; if (use_cover_edges(pc)) { - // Only hash the lower 12 bits so the hash is - // independent of any module offsets. - sig |= (pc & 0xFFF) ^ (hash(prev_pc & 0xFFF) & 0xFFF); + // Only hash the lower 12 bits so the hash is independent of any module offsets. + const uint64 mask = (1 << 12) - 1; + sig ^= hash(prev_pc & mask) & mask; } bool filter = coverage_filter(pc); // Ignore the edge only if both current and previous PCs are filtered out |
