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

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

Issue 2363733003: Make syzyasan_rtl compile in 64 bit (Closed)
Patch Set: Nits. Created 4 years, 2 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
« no previous file with comments | « syzygy/agent/asan/runtime.h ('k') | syzygy/agent/asan/shadow_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 (feature_set & ASAN_FEATURE_ENABLE_PAGE_PROTECTIONS) != 0; 1016 (feature_set & ASAN_FEATURE_ENABLE_PAGE_PROTECTIONS) != 0;
1017 params_.enable_large_block_heap = 1017 params_.enable_large_block_heap =
1018 (feature_set & ASAN_FEATURE_ENABLE_LARGE_BLOCK_HEAP) != 0; 1018 (feature_set & ASAN_FEATURE_ENABLE_LARGE_BLOCK_HEAP) != 0;
1019 } 1019 }
1020 1020
1021 void AsanRuntime::GetBadAccessInformation(AsanErrorInfo* error_info) { 1021 void AsanRuntime::GetBadAccessInformation(AsanErrorInfo* error_info) {
1022 base::AutoLock lock(lock_); 1022 base::AutoLock lock(lock_);
1023 1023
1024 // Checks if this is an access to an internal structure or if it's an access 1024 // Checks if this is an access to an internal structure or if it's an access
1025 // in the upper region of the memory (over the 2 GB limit). 1025 // in the upper region of the memory (over the 2 GB limit).
1026 if ((reinterpret_cast<size_t>(error_info->location) & (1 << 31)) != 0 || 1026 if ((reinterpret_cast<size_t>(error_info->location) >=
1027 shadow()->memory_size()) ||
1027 shadow()->GetShadowMarkerForAddress(error_info->location) == 1028 shadow()->GetShadowMarkerForAddress(error_info->location) ==
1028 kAsanMemoryMarker) { 1029 kAsanMemoryMarker) {
1029 error_info->error_type = WILD_ACCESS; 1030 error_info->error_type = WILD_ACCESS;
1030 } else if (shadow()->GetShadowMarkerForAddress(error_info->location) == 1031 } else if (shadow()->GetShadowMarkerForAddress(error_info->location) ==
1031 kInvalidAddressMarker) { 1032 kInvalidAddressMarker) {
1032 error_info->error_type = INVALID_ADDRESS; 1033 error_info->error_type = INVALID_ADDRESS;
1033 } else { 1034 } else {
1034 ErrorInfoGetBadAccessInformation(shadow(), stack_cache_.get(), error_info); 1035 ErrorInfoGetBadAccessInformation(shadow(), stack_cache_.get(), error_info);
1035 } 1036 }
1036 } 1037 }
1037 1038
1038 bool AsanRuntime::allocation_filter_flag() { 1039 bool AsanRuntime::allocation_filter_flag() {
1039 return heap_manager_->allocation_filter_flag(); 1040 return heap_manager_->allocation_filter_flag();
1040 } 1041 }
1041 1042
1042 void AsanRuntime::set_allocation_filter_flag(bool value) { 1043 void AsanRuntime::set_allocation_filter_flag(bool value) {
1043 heap_manager_->set_allocation_filter_flag(value); 1044 heap_manager_->set_allocation_filter_flag(value);
1044 } 1045 }
1045 1046
1046 void AsanRuntime::AddThreadId(uint32_t thread_id) { 1047 void AsanRuntime::AddThreadId(uint32_t thread_id) {
1047 DCHECK_NE(0u, thread_id); 1048 DCHECK_NE(0u, thread_id);
1048 base::AutoLock lock(thread_ids_lock_); 1049 base::AutoLock lock(thread_ids_lock_);
1049 thread_ids_.insert(thread_id); 1050 thread_ids_.insert(thread_id);
1050 } 1051 }
1051 1052
1052 bool AsanRuntime::ThreadIdIsValid(uint32_t thread_id) { 1053 bool AsanRuntime::ThreadIdIsValid(uint32_t thread_id) {
1053 base::AutoLock lock(thread_ids_lock_); 1054 base::AutoLock lock(thread_ids_lock_);
1054 return thread_ids_.count(thread_id) > 0; 1055 return thread_ids_.find(thread_id) != thread_ids_.end();
1055 } 1056 }
1056 1057
1057 bool AsanRuntime::HeapIdIsValid(HeapManagerInterface::HeapId heap_id) { 1058 bool AsanRuntime::HeapIdIsValid(HeapManagerInterface::HeapId heap_id) {
1058 // Consider dying heaps in this query, as they are still valid from the 1059 // Consider dying heaps in this query, as they are still valid from the
1059 // point of view of an error report. 1060 // point of view of an error report.
1060 return heap_manager_->IsValidHeapIdUnlocked(heap_id, true); 1061 return heap_manager_->IsValidHeapIdUnlocked(heap_id, true);
1061 } 1062 }
1062 1063
1063 HeapType AsanRuntime::GetHeapType(HeapManagerInterface::HeapId heap_id) { 1064 HeapType AsanRuntime::GetHeapType(HeapManagerInterface::HeapId heap_id) {
1064 return heap_manager_->GetHeapTypeUnlocked(heap_id); 1065 return heap_manager_->GetHeapTypeUnlocked(heap_id);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 if (heap_manager_->enable_page_protections_) 1240 if (heap_manager_->enable_page_protections_)
1240 enabled_features |= ASAN_FEATURE_ENABLE_PAGE_PROTECTIONS; 1241 enabled_features |= ASAN_FEATURE_ENABLE_PAGE_PROTECTIONS;
1241 if (params_.enable_large_block_heap) 1242 if (params_.enable_large_block_heap)
1242 enabled_features |= ASAN_FEATURE_ENABLE_LARGE_BLOCK_HEAP; 1243 enabled_features |= ASAN_FEATURE_ENABLE_LARGE_BLOCK_HEAP;
1243 1244
1244 return enabled_features; 1245 return enabled_features;
1245 } 1246 }
1246 1247
1247 } // namespace asan 1248 } // namespace asan
1248 } // namespace agent 1249 } // namespace agent
OLDNEW
« no previous file with comments | « syzygy/agent/asan/runtime.h ('k') | syzygy/agent/asan/shadow_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698