Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimantal dfsan mode "fast16labels=1"
Summary: dfsan mode "fast16labels=1". In this mode the labels are treated as 16-bit bit masks. Reviewers: pcc Reviewed By: pcc Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D62870 llvm-svn: 362859
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %clang_dfsan %s -o %t && DFSAN_OPTIONS=fast16labels=1 %run %t | ||
// | ||
// Tests DFSAN_OPTIONS=fast16labels=1 | ||
// | ||
#include <sanitizer/dfsan_interface.h> | ||
|
||
#include <assert.h> | ||
#include <stdio.h> | ||
|
||
int foo(int a, int b) { | ||
return a + b; | ||
} | ||
|
||
int main() { | ||
int a = 10; | ||
int b = 20; | ||
dfsan_set_label(8, &a, sizeof(a)); | ||
dfsan_set_label(512, &b, sizeof(b)); | ||
int c = foo(a, b); | ||
printf("A: 0x%x\n", dfsan_get_label(a)); | ||
printf("B: 0x%x\n", dfsan_get_label(b)); | ||
dfsan_label l = dfsan_get_label(c); | ||
printf("C: 0x%x\n", l); | ||
assert(l == 520); // OR of the other two labels. | ||
} |