brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 6b4a35a Raw
35 lines · c
1// RUN: %clang_dfsan -gmlt -mllvm -dfsan-track-origins=1 %s -o %t && \2// RUN:     %run %t >%t.out 2>&13// RUN: FileCheck %s < %t.out4// 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>&17// RUN: FileCheck %s < %t.out8 9#include <sanitizer/dfsan_interface.h>10 11__attribute__((noinline)) uint64_t foo(uint64_t a, uint64_t b) { return a + b; }12 13int main(int argc, char *argv[]) {14  uint64_t a = 10;15  uint64_t b = 20;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);20}21 22// CHECK: Taint value 0x8 {{.*}} origin tracking ()23// CHECK: Origin value: {{.*}}, Taint value was stored to memory at24// CHECK: #0 {{.*}} in main {{.*}}origin_set_label.c:[[@LINE-7]]25 26// CHECK: Origin value: {{.*}}, Taint value was created at27// CHECK: #0 {{.*}} in main {{.*}}origin_set_label.c:[[@LINE-11]]28 29// CHECK: Taint value 0x8 {{.*}} origin tracking ()30// CHECK: Origin value: {{.*}}, Taint value was stored to memory at31// CHECK: #0 {{.*}} in main {{.*}}origin_set_label.c:[[@LINE-14]]32 33// CHECK: Origin value: {{.*}}, Taint value was created at34// CHECK: #0 {{.*}} in main {{.*}}origin_set_label.c:[[@LINE-18]]35