aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor_linux.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-11-19 16:42:32 +0100
committerDmitry Vyukov <dvyukov@google.com>2024-11-20 11:33:58 +0000
commitf56b4dcc82d7af38bf94d643c5750cf49a91a297 (patch)
tree19b2ea6bfcbf61ab7287d420f39c45432bd9b4cc /executor/executor_linux.h
parent7d02db5adbb376babbbd3199f8c530e468292727 (diff)
pkg/manager: show number of times coverage for each call has overflowed
If the overflows happen often, it's bad. Add visibility into this.
Diffstat (limited to 'executor/executor_linux.h')
-rw-r--r--executor/executor_linux.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/executor/executor_linux.h b/executor/executor_linux.h
index 82a1d559a..f2e9d4df6 100644
--- a/executor/executor_linux.h
+++ b/executor/executor_linux.h
@@ -180,14 +180,22 @@ static void cover_reset(cover_t* cov)
cover_unprotect(cov);
*(uint64*)cov->data = 0;
cover_protect(cov);
+ cov->overflow = false;
+}
+
+template <typename cover_data_t>
+static void cover_collect_impl(cover_t* cov)
+{
+ cov->size = *(cover_data_t*)cov->data;
+ cov->overflow = (cov->data + (cov->size + 2) * sizeof(cover_data_t)) > cov->data_end;
}
static void cover_collect(cover_t* cov)
{
if (is_kernel_64_bit)
- cov->size = *(uint64*)cov->data;
+ cover_collect_impl<uint64>(cov);
else
- cov->size = *(uint32*)cov->data;
+ cover_collect_impl<uint32>(cov);
}
// One does not simply exit.