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

Side by Side Diff: syzygy/agent/asan/rtl_unittest.cc

Issue 2526563002: Add a target to run the SyzyAsan RTL unittests in 4G (Closed)
Patch Set: Disable the wild access test in 4G. Created 4 years 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 2012 Google Inc. All Rights Reserved. 1 // Copyright 2012 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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include <windows.h> 15 #include <windows.h>
16 16
17 #include "gtest/gtest.h" 17 #include "gtest/gtest.h"
18 #include "syzygy/agent/asan/heap_checker.h" 18 #include "syzygy/agent/asan/heap_checker.h"
19 #include "syzygy/agent/asan/rtl_impl.h" 19 #include "syzygy/agent/asan/rtl_impl.h"
20 #include "syzygy/agent/asan/runtime.h" 20 #include "syzygy/agent/asan/runtime.h"
21 #include "syzygy/agent/asan/unittest_util.h" 21 #include "syzygy/agent/asan/unittest_util.h"
22 #include "syzygy/testing/laa.h"
22 23
23 namespace agent { 24 namespace agent {
24 namespace asan { 25 namespace asan {
25 26
26 namespace { 27 namespace {
27 28
28 using testing::AsanBlockInfoVector; 29 using testing::AsanBlockInfoVector;
29 using testing::ClangMemoryAccessorTester; 30 using testing::ClangMemoryAccessorTester;
30 using testing::MemoryAccessorTester; 31 using testing::MemoryAccessorTester;
31 using testing::ScopedAsanAlloc; 32 using testing::ScopedAsanAlloc;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 264
264 tester_.tester()->set_expected_error_type(DOUBLE_FREE); 265 tester_.tester()->set_expected_error_type(DOUBLE_FREE);
265 EXPECT_FALSE(HeapFreeFunction(heap_, 0, mem_ptr)); 266 EXPECT_FALSE(HeapFreeFunction(heap_, 0, mem_ptr));
266 EXPECT_TRUE(tester_.tester()->memory_error_detected()); 267 EXPECT_TRUE(tester_.tester()->memory_error_detected());
267 EXPECT_TRUE(LogContains(kAttemptingDoubleFree)); 268 EXPECT_TRUE(LogContains(kAttemptingDoubleFree));
268 EXPECT_TRUE(LogContains("previously allocated here")); 269 EXPECT_TRUE(LogContains("previously allocated here"));
269 EXPECT_TRUE(LogContains("freed here")); 270 EXPECT_TRUE(LogContains("freed here"));
270 } 271 }
271 272
272 TYPED_TEST(AsanRtlTypedTest, AsanCheckWildAccess) { 273 TYPED_TEST(AsanRtlTypedTest, AsanCheckWildAccess) {
274 TEST_ONLY_SUPPORTS_2G()
chrisha 2016/11/23 15:19:27 ;
Sébastien Marchand 2016/11/23 15:28:04 Done.
275
273 FARPROC check_access_fn = 276 FARPROC check_access_fn =
274 ::GetProcAddress(asan_rtl_, tester_.function_name()); 277 ::GetProcAddress(asan_rtl_, tester_.function_name());
275 ASSERT_TRUE(check_access_fn != NULL); 278 ASSERT_TRUE(check_access_fn != NULL);
276 279
277 #ifndef _WIN64 280 #ifndef _WIN64
278 void* addr = reinterpret_cast<void*>(0x80000000); 281 void* addr = reinterpret_cast<void*>(0x80000000);
279 #else 282 #else
280 void* addr = reinterpret_cast<void*>(1ULL << 63); 283 void* addr = reinterpret_cast<void*>(1ULL << 63);
281 #endif 284 #endif
282 285
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 EXPECT_EQ("Enabled", experiments["SyzyASANPageProtections"]); 738 EXPECT_EQ("Enabled", experiments["SyzyASANPageProtections"]);
736 EXPECT_EQ("Enabled", experiments["SyzyASANLargeBlockHeap"]); 739 EXPECT_EQ("Enabled", experiments["SyzyASANLargeBlockHeap"]);
737 740
738 // This implicitly asserts the full contents of the map by asserting 741 // This implicitly asserts the full contents of the map by asserting
739 // on the size after looking up the expected keys. 742 // on the size after looking up the expected keys.
740 EXPECT_EQ(2U, experiments.size()); 743 EXPECT_EQ(2U, experiments.size());
741 } 744 }
742 745
743 } // namespace asan 746 } // namespace asan
744 } // namespace agent 747 } // namespace agent
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698