1// RUN: %clang_dfsan -gmlt -mllvm -dfsan-fast-16-labels=true -mllvm -dfsan-track-origins=1 %s -o %t && \
2// RUN: %run %t >%t.out 2>&1
3// RUN: FileCheck %s --check-prefix=CHECK < %t.out
4//
5// REQUIRES: x86_64-target-arch
6
7#include <sanitizer/dfsan_interface.h>
8
9int main(int argc, char *argv[]) {
10 uint64_t a = 10;
11 dfsan_set_label(8, &a, sizeof(a));
12 size_t origin_addr =
13 (((size_t)&a & ~0x700000000000LL + 0x200000000000LL) & ~0x3UL);
14 asm("mov %0, %%rax": :"r"(origin_addr));
15 asm("movq $0, (%rax)");
16 dfsan_print_origin_trace(&a, "invalid");
17}
18
19// CHECK: Taint value 0x8 (at {{.*}}) origin tracking (invalid)
20// CHECK: Taint value 0x8 (at {{.*}}) has invalid origin tracking. This can be a DFSan bug.
21