| OLD | NEW |
| 1 // Copyright 2014 Google Inc. All Rights Reserved. | 1 // Copyright 2014 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 static const TestMemoryInterceptors::ClangInterceptFunction | 112 static const TestMemoryInterceptors::ClangInterceptFunction |
| 113 clang_intercept_functions[] = { | 113 clang_intercept_functions[] = { |
| 114 #ifndef _WIN64 | 114 #ifndef _WIN64 |
| 115 #define DEFINE_CLANG_INTERCEPT_FUNCTION_TABLE(access_size, access_mode_str, \ | 115 #define DEFINE_CLANG_INTERCEPT_FUNCTION_TABLE(access_size, access_mode_str, \ |
| 116 access_mode) \ | 116 access_mode) \ |
| 117 { asan_##access_mode_str##access_size##_2gb, access_size } \ | 117 { asan_##access_mode_str##access_size##_2gb, access_size } \ |
| 118 , {asan_##access_mode_str##access_size##_4gb, access_size}, | 118 , {asan_##access_mode_str##access_size##_4gb, access_size}, |
| 119 #else | 119 #else |
| 120 #define DEFINE_CLANG_INTERCEPT_FUNCTION_TABLE(access_size, access_mode_str, \ | 120 #define DEFINE_CLANG_INTERCEPT_FUNCTION_TABLE(access_size, access_mode_str, \ |
| 121 access_mode) \ | 121 access_mode) \ |
| 122 { asan_##access_mode_str##access_size##_8tb, access_size } \ | 122 {asan_##access_mode_str##access_size##_128tb, access_size}, |
| 123 , {asan_##access_mode_str##access_size##_128tb, access_size}, | |
| 124 #endif | 123 #endif |
| 125 CLANG_ASAN_MEM_INTERCEPT_FUNCTIONS( | 124 CLANG_ASAN_MEM_INTERCEPT_FUNCTIONS( |
| 126 DEFINE_CLANG_INTERCEPT_FUNCTION_TABLE) | 125 DEFINE_CLANG_INTERCEPT_FUNCTION_TABLE) |
| 127 | 126 |
| 128 #undef DEFINE_CLANG_INTERCEPT_FUNCTION_TABLE | 127 #undef DEFINE_CLANG_INTERCEPT_FUNCTION_TABLE |
| 129 }; | 128 }; |
| 130 | 129 |
| 131 static const TestMemoryInterceptors::ClangInterceptFunction | 130 static const TestMemoryInterceptors::ClangInterceptFunction |
| 132 clang_redirect_functions[] = { | 131 clang_redirect_functions[] = { |
| 133 #define DEFINE_CLANG_REDIRECT_FUNCTION_TABLE(access_size, access_mode_str, \ | 132 #define DEFINE_CLANG_REDIRECT_FUNCTION_TABLE(access_size, access_mode_str, \ |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 .WillRepeatedly(Return(MEMORY_ACCESSOR_MODE_NOOP)); | 308 .WillRepeatedly(Return(MEMORY_ACCESSOR_MODE_NOOP)); |
| 310 tester_.TestRedirectorValidAccess(); | 309 tester_.TestRedirectorValidAccess(); |
| 311 } | 310 } |
| 312 | 311 |
| 313 TYPED_TEST(MemoryInterceptorsTypedTest, TestRedirectorsSmallMemory) { | 312 TYPED_TEST(MemoryInterceptorsTypedTest, TestRedirectorsSmallMemory) { |
| 314 EXPECT_CALL(*this, OnRedirectorInvocation(_)) | 313 EXPECT_CALL(*this, OnRedirectorInvocation(_)) |
| 315 .Times(3 * static_cast<int>(tester_.RedirectorsCount())) | 314 .Times(3 * static_cast<int>(tester_.RedirectorsCount())) |
| 316 #ifndef _WIN64 | 315 #ifndef _WIN64 |
| 317 .WillRepeatedly(Return(MEMORY_ACCESSOR_MODE_2G)); | 316 .WillRepeatedly(Return(MEMORY_ACCESSOR_MODE_2G)); |
| 318 #else | 317 #else |
| 319 .WillRepeatedly(Return(MEMORY_ACCESSOR_MODE_8TB)); | 318 .WillRepeatedly(Return(MEMORY_ACCESSOR_MODE_128TB)); |
| 320 #endif | 319 #endif |
| 321 | 320 |
| 322 // Test valid, underrun and overrun. | 321 // Test valid, underrun and overrun. |
| 323 tester_.TestRedirectorValidAccess(); | 322 tester_.TestRedirectorValidAccess(); |
| 324 tester_.TestRedirectorOverrunAccess(); | 323 tester_.TestRedirectorOverrunAccess(); |
| 325 tester_.TestRedirectorUnderrunAccess(); | 324 tester_.TestRedirectorUnderrunAccess(); |
| 326 } | 325 } |
| 327 | 326 |
| 328 #ifndef _WIN64 | 327 #ifndef _WIN64 |
| 329 TEST_F(MemoryInterceptorsTest, TestStringValidAccess) { | 328 TEST_F(MemoryInterceptorsTest, TestStringValidAccess) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 358 // exception of the stos instruction, which is tested only in two modes | 357 // exception of the stos instruction, which is tested only in two modes |
| 359 // and six variants. | 358 // and six variants. |
| 360 .Times(4 * arraysize(string_redirect_functions) - 2 * 6) | 359 .Times(4 * arraysize(string_redirect_functions) - 2 * 6) |
| 361 .WillRepeatedly(Return(MEMORY_ACCESSOR_MODE_2G)); | 360 .WillRepeatedly(Return(MEMORY_ACCESSOR_MODE_2G)); |
| 362 TestStringOverrunAccess(string_redirect_functions); | 361 TestStringOverrunAccess(string_redirect_functions); |
| 363 } | 362 } |
| 364 #endif | 363 #endif |
| 365 | 364 |
| 366 } // namespace asan | 365 } // namespace asan |
| 367 } // namespace agent | 366 } // namespace agent |
| OLD | NEW |