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
5 #include <sanitizer/dfsan_interface.h>
7 __attribute__((noinline
)) uint64_t foo(uint64_t a
, uint64_t b
) { return a
+ b
; }
9 int main(int argc
, char *argv
[]) {
12 dfsan_set_label(8, &a
, sizeof(a
));
13 uint64_t c
= foo(a
, b
);
14 dfsan_print_origin_trace(&c
, NULL
);
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]]
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]]
25 // CHECK: Origin value: {{.*}}, Taint value was stored to memory at
26 // CHECK: #0 {{.*}} in main {{.*}}origin_track_ld.c:[[@LINE-13]]
28 // CHECK: Origin value: {{.*}}, Taint value was created at
29 // CHECK: #0 {{.*}} in main {{.*}}origin_track_ld.c:[[@LINE-17]]