diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-01-22 13:33:16 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-01-22 13:33:16 +0000 |
commit | a50b9b2e06f85fef88f27724a16f6f62c5dd229f (patch) | |
tree | fdb90d4fb82539e5764d63c3b5f26dec36a0899a /test | |
parent | cafe9a53643f3d813fa0a328a62175e19ff3a1ca (diff) |
[msan] Better use-after-free reports.
By attaching an extra integer tag to heap origins, we are able
to distinguish between uninits
- created by heap allocation,
- created by heap deallocation (i.e. use-after-free),
- created by __msan_allocated_memory call,
- etc.
See https://code.google.com/p/memory-sanitizer/issues/detail?id=35.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226821 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/msan/msan_print_shadow.cc | 6 | ||||
-rw-r--r-- | test/msan/select_float_origin.cc | 2 | ||||
-rw-r--r-- | test/msan/use-after-free.cc | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/test/msan/msan_print_shadow.cc b/test/msan/msan_print_shadow.cc index 0cc1d660b..f4894596a 100644 --- a/test/msan/msan_print_shadow.cc +++ b/test/msan/msan_print_shadow.cc @@ -99,7 +99,7 @@ int main(void) { // CHECK-ORIGINS: #1 {{.*}} in main{{.*}}msan_print_shadow.cc:14 // CHECK-ORIGINS: Origin B (origin_id {{.*}}): -// CHECK-ORIGINS: Uninitialized value was created by a heap allocation +// CHECK-ORIGINS: Memory was marked as uninitialized // CHECK-ORIGINS: #0 {{.*}} in __msan_allocated_memory // CHECK-ORIGINS: #1 {{.*}} in main{{.*}}msan_print_shadow.cc:18 @@ -110,13 +110,13 @@ int main(void) { // CHECK-ORIGINS: #0 {{.*}} in main{{.*}}msan_print_shadow.cc:12 // CHECK-ORIGINS: Origin D (origin_id {{.*}}): -// CHECK-ORIGINS: Uninitialized value was created by a heap allocation +// CHECK-ORIGINS: Memory was marked as uninitialized // CHECK-ORIGINS: #0 {{.*}} in __msan_allocated_memory // CHECK-ORIGINS: #1 {{.*}} in main{{.*}}msan_print_shadow.cc:20 // ... // CHECK-ORIGINS: Origin Z (origin_id {{.*}}): -// CHECK-ORIGINS: Uninitialized value was created by a heap allocation +// CHECK-ORIGINS: Memory was marked as uninitialized // CHECK-ORIGINS: #0 {{.*}} in __msan_allocated_memory // CHECK-ORIGINS: #1 {{.*}} in main{{.*}}msan_print_shadow.cc:42 diff --git a/test/msan/select_float_origin.cc b/test/msan/select_float_origin.cc index ca8f3a83b..75731dc45 100644 --- a/test/msan/select_float_origin.cc +++ b/test/msan/select_float_origin.cc @@ -17,7 +17,7 @@ int main() { __msan_allocated_memory(&y, sizeof(y)); float z = b ? x : y; if (z > 0) printf(".\n"); - // CHECK: Uninitialized value was created by a heap allocation + // CHECK: Memory was marked as uninitialized // CHECK: {{#0 0x.* in .*__msan_allocated_memory}} // CHECK: {{#1 0x.* in main .*select_float_origin.cc:}}[[@LINE-6]] return 0; diff --git a/test/msan/use-after-free.cc b/test/msan/use-after-free.cc index 5b408c536..869bad98e 100644 --- a/test/msan/use-after-free.cc +++ b/test/msan/use-after-free.cc @@ -27,7 +27,7 @@ int main(int argc, char **argv) { // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value // CHECK: {{#0 0x.* in main .*use-after-free.cc:}}[[@LINE-3]] - // CHECK-ORIGINS: Uninitialized value was created by a heap allocation + // CHECK-ORIGINS: Uninitialized value was created by a heap deallocation // CHECK-ORIGINS: {{#0 0x.* in .*free}} // CHECK-ORIGINS: {{#1 0x.* in main .*use-after-free.cc:}}[[@LINE-9]] return 0; |