OLD | NEW |
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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 // TODO(sebmarchand): Report more blocks if necessary. | 917 // TODO(sebmarchand): Report more blocks if necessary. |
918 AsanBlockInfo* asan_block_info = block_infos; | 918 AsanBlockInfo* asan_block_info = block_infos; |
919 error_info->corrupt_ranges[i].block_info = block_infos; | 919 error_info->corrupt_ranges[i].block_info = block_infos; |
920 error_info->corrupt_ranges[i].block_info_count = 1; | 920 error_info->corrupt_ranges[i].block_info_count = 1; |
921 ++block_infos; | 921 ++block_infos; |
922 | 922 |
923 // Use a shadow walker to find the first corrupt block in this range and | 923 // Use a shadow walker to find the first corrupt block in this range and |
924 // copy its metadata. It's fine for the upper bound address calculation to | 924 // copy its metadata. It's fine for the upper bound address calculation to |
925 // overflow to 0, as this represents the end of the 4GB address space. | 925 // overflow to 0, as this represents the end of the 4GB address space. |
926 ShadowWalker shadow_walker( | 926 ShadowWalker shadow_walker( |
927 shadow(), false, | 927 shadow(), reinterpret_cast<const uint8_t*>(corrupt_ranges[i].address), |
928 reinterpret_cast<const uint8_t*>(corrupt_ranges[i].address), | |
929 reinterpret_cast<const uint8_t*>(corrupt_ranges[i].address) + | 928 reinterpret_cast<const uint8_t*>(corrupt_ranges[i].address) + |
930 corrupt_ranges[i].length); | 929 corrupt_ranges[i].length); |
931 BlockInfo block_info = {}; | 930 BlockInfo block_info = {}; |
932 CHECK(shadow_walker.Next(&block_info)); | 931 CHECK(shadow_walker.Next(&block_info)); |
933 // The heap checker removes block protections as it goes, so this block | 932 // The heap checker removes block protections as it goes, so this block |
934 // should be readable. However, remove page protections just to be sure. | 933 // should be readable. However, remove page protections just to be sure. |
935 // They are left turned off so that the minidump generation can introspect | 934 // They are left turned off so that the minidump generation can introspect |
936 // the block. | 935 // the block. |
937 BlockProtectNone(block_info, shadow()); | 936 BlockProtectNone(block_info, shadow()); |
938 ErrorInfoGetAsanBlockInfo(shadow(), block_info, stack_cache_.get(), | 937 ErrorInfoGetAsanBlockInfo(shadow(), block_info, stack_cache_.get(), |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 if (heap_manager_->enable_page_protections_) | 1239 if (heap_manager_->enable_page_protections_) |
1241 enabled_features |= ASAN_FEATURE_ENABLE_PAGE_PROTECTIONS; | 1240 enabled_features |= ASAN_FEATURE_ENABLE_PAGE_PROTECTIONS; |
1242 if (params_.enable_large_block_heap) | 1241 if (params_.enable_large_block_heap) |
1243 enabled_features |= ASAN_FEATURE_ENABLE_LARGE_BLOCK_HEAP; | 1242 enabled_features |= ASAN_FEATURE_ENABLE_LARGE_BLOCK_HEAP; |
1244 | 1243 |
1245 return enabled_features; | 1244 return enabled_features; |
1246 } | 1245 } |
1247 | 1246 |
1248 } // namespace asan | 1247 } // namespace asan |
1249 } // namespace agent | 1248 } // namespace agent |
OLD | NEW |