-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathkernel.patch
32 lines (31 loc) · 894 Bytes
/
kernel.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--- a/kernel/kcov.c 2017-12-16 16:43:08.000000000 -0500
+++ b/kernel/kcov.c 2020-12-01 17:45:39.286426893 -0500
@@ -111,6 +111,29 @@
}
EXPORT_SYMBOL(__sanitizer_cov_trace_pc);
+/* Entry point for object cover
+ */
+void notrace __sanitizer_obj_cov_trace_pc(void)
+{
+ struct task_struct *t;
+ unsigned long *area;
+ unsigned long ip = canonicalize_ip(_RET_IP_);
+ unsigned long pos;
+
+ t = current;
+ if (!check_kcov_mode(KCOV_MODE_TRACE_PC, t))
+ return;
+
+ area = t->kcov_area;
+ /* The first 64-bit word is the number of subsequent PCs. */
+ pos = READ_ONCE(area[0]) + 1;
+ if (likely(pos < t->kcov_size)) {
+ area[pos] = ip & 0xffffffff;
+ WRITE_ONCE(area[0], pos);
+ }
+}
+EXPORT_SYMBOL(__sanitizer_obj_cov_trace_pc);
+
#ifdef CONFIG_KCOV_ENABLE_COMPARISONS
static void write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip)
{