1 | // RUN: %clang_dfsan -gmlt -mllvm -dfsan-track-origins=2 %s -o %t && \ |
2 | // RUN: %run %t > %t.out 2>&1 |
3 | // RUN: FileCheck %s < %t.out |
4 | |
5 | #include <sanitizer/dfsan_interface.h> |
6 | |
7 | __attribute__((noinline)) uint64_t foo(uint64_t a, uint64_t b) { return a + b; } |
8 | |
9 | int main(int argc, char *argv[]) { |
10 | uint64_t a = 10; |
11 | uint64_t b = 20; |
12 | dfsan_set_label(label: 8, addr: &a, size: sizeof(a)); |
13 | uint64_t c = foo(a, b); |
14 | dfsan_print_origin_trace(addr: &c, NULL); |
15 | } |
16 | |
17 | // CHECK: Taint value 0x8 {{.*}} origin tracking () |
18 | // CHECK: Origin value: {{.*}}, Taint value was stored to memory at |
19 | // CHECK: #0 {{.*}} in main {{.*}}origin_track_ld.c:[[@LINE-6]] |
20 | |
21 | // CHECK: Origin value: {{.*}}, Taint value was stored to memory at |
22 | // CHECK: #0 {{.*}} in foo.dfsan {{.*}}origin_track_ld.c:[[@LINE-15]] |
23 | // CHECK: #1 {{.*}} in main {{.*}}origin_track_ld.c:[[@LINE-10]] |
24 | |
25 | // CHECK: Origin value: {{.*}}, Taint value was stored to memory at |
26 | // CHECK: #0 {{.*}} in main {{.*}}origin_track_ld.c:[[@LINE-13]] |
27 | |
28 | // CHECK: Origin value: {{.*}}, Taint value was created at |
29 | // CHECK: #0 {{.*}} in main {{.*}}origin_track_ld.c:[[@LINE-17]] |
30 | |