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