Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: syzygy/integration_tests/asan_interceptors_tests.cc

Issue 2983783002: Run the integration tests against the Clang instrumented DLL. (Closed)
Patch Set: Address Chris comment. Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 Google Inc. All Rights Reserved. 1 // Copyright 2013 Google Inc. All Rights Reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 size_t AsanCorruptBlock() { 1138 size_t AsanCorruptBlock() {
1139 size_t* mem = new size_t[10]; 1139 size_t* mem = new size_t[10];
1140 size_t original_value = NonInterceptedRead(&mem[-1]); 1140 size_t original_value = NonInterceptedRead(&mem[-1]);
1141 NonInterceptedWrite(&mem[-1], original_value + 1); 1141 NonInterceptedWrite(&mem[-1], original_value + 1);
1142 size_t ret = mem[0]; 1142 size_t ret = mem[0];
1143 delete[] mem; 1143 delete[] mem;
1144 return ret; 1144 return ret;
1145 } 1145 }
1146 1146
1147 size_t AsanCorruptBlockInQuarantine() { 1147 size_t AsanCorruptBlockInQuarantine() {
1148 // This test requires the HeapCreate/HeapDestroy functions to be intercepted
1149 // and so doesn't work with a Clang-instrumented binary.
1150 // TODO(sebmarchand): Find another way to flush the quarantine.
1148 HANDLE heap = ::HeapCreate(NULL, 0, 0); 1151 HANDLE heap = ::HeapCreate(NULL, 0, 0);
1149 size_t* mem = 1152 size_t* mem =
1150 static_cast<size_t*>(::HeapAlloc(heap, NULL, 10 * sizeof(size_t))); 1153 static_cast<size_t*>(::HeapAlloc(heap, NULL, 10 * sizeof(size_t)));
1151 size_t ret = mem[0]; 1154 size_t ret = mem[0];
1152 ::HeapFree(heap, NULL, mem); 1155 ::HeapFree(heap, NULL, mem);
1153 1156
1154 // We modify the block after deletion so that it will cause an error to be 1157 // We modify the block after deletion so that it will cause an error to be
1155 // fired when the block is trimmed from the quarantine. 1158 // fired when the block is trimmed from the quarantine.
1156 size_t original_value = NonInterceptedRead(&mem[0]); 1159 size_t original_value = NonInterceptedRead(&mem[0]);
1157 NonInterceptedWrite(&mem[0], original_value + 1); 1160 NonInterceptedWrite(&mem[0], original_value + 1);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 size_t AsanNullptrAccessNoHeapCorruptionUninstrumented() { 1284 size_t AsanNullptrAccessNoHeapCorruptionUninstrumented() {
1282 size_t value = 0; 1285 size_t value = 0;
1283 size_t* ptr = nullptr; 1286 size_t* ptr = nullptr;
1284 1287
1285 value = NonInterceptedRead<size_t>(ptr); 1288 value = NonInterceptedRead<size_t>(ptr);
1286 1289
1287 return value; 1290 return value;
1288 } 1291 }
1289 1292
1290 } // namespace testing 1293 } // namespace testing
OLDNEW
« no previous file with comments | « syzygy/integration_tests/asan_interceptors_tests.h ('k') | syzygy/integration_tests/instrument_integration_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698