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

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

Issue 2379023002: [SyzyAsan] Fix overflow error in ShadowWalker for 4GB 32-bit processes. (Closed)
Patch Set: Fix comments. 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
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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 error_info->corrupt_ranges[i] = corrupt_ranges[i]; 936 error_info->corrupt_ranges[i] = corrupt_ranges[i];
937 937
938 // Allocate space for the first block of this range on the stack. 938 // Allocate space for the first block of this range on the stack.
939 // TODO(sebmarchand): Report more blocks if necessary. 939 // TODO(sebmarchand): Report more blocks if necessary.
940 AsanBlockInfo* asan_block_info = block_infos; 940 AsanBlockInfo* asan_block_info = block_infos;
941 error_info->corrupt_ranges[i].block_info = block_infos; 941 error_info->corrupt_ranges[i].block_info = block_infos;
942 error_info->corrupt_ranges[i].block_info_count = 1; 942 error_info->corrupt_ranges[i].block_info_count = 1;
943 ++block_infos; 943 ++block_infos;
944 944
945 // Use a shadow walker to find the first corrupt block in this range and 945 // Use a shadow walker to find the first corrupt block in this range and
946 // copy its metadata. 946 // copy its metadata. It's fine for the upper bound address calculation to
947 // overflow to 0, as this represents the end of the 4GB address space.
947 ShadowWalker shadow_walker( 948 ShadowWalker shadow_walker(
948 shadow(), false, 949 shadow(), false,
949 reinterpret_cast<const uint8_t*>(corrupt_ranges[i].address), 950 reinterpret_cast<const uint8_t*>(corrupt_ranges[i].address),
950 reinterpret_cast<const uint8_t*>(corrupt_ranges[i].address) + 951 reinterpret_cast<const uint8_t*>(corrupt_ranges[i].address) +
951 corrupt_ranges[i].length); 952 corrupt_ranges[i].length);
952 BlockInfo block_info = {}; 953 BlockInfo block_info = {};
953 CHECK(shadow_walker.Next(&block_info)); 954 CHECK(shadow_walker.Next(&block_info));
954 // The heap checker removes block protections as it goes, so this block 955 // The heap checker removes block protections as it goes, so this block
955 // should be readable. However, remove page protections just to be sure. 956 // should be readable. However, remove page protections just to be sure.
956 // They are left turned off so that the minidump generation can introspect 957 // They are left turned off so that the minidump generation can introspect
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 if (crash_reporter_.get() != nullptr && 1265 if (crash_reporter_.get() != nullptr &&
1265 crash_reporter_->GetName() == reporters::CrashpadReporter::kName) { 1266 crash_reporter_->GetName() == reporters::CrashpadReporter::kName) {
1266 enabled_features |= ASAN_FEATURE_ENABLE_CRASHPAD; 1267 enabled_features |= ASAN_FEATURE_ENABLE_CRASHPAD;
1267 } 1268 }
1268 1269
1269 return enabled_features; 1270 return enabled_features;
1270 } 1271 }
1271 1272
1272 } // namespace asan 1273 } // namespace asan
1273 } // namespace agent 1274 } // namespace agent
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698