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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 // The allocation can fail if we're out of memory. | 229 // The allocation can fail if we're out of memory. |
230 if (alloc == nullptr) | 230 if (alloc == nullptr) |
231 return nullptr; | 231 return nullptr; |
232 | 232 |
233 DCHECK_NE(static_cast<void*>(nullptr), alloc); | 233 DCHECK_NE(static_cast<void*>(nullptr), alloc); |
234 DCHECK_EQ(0u, reinterpret_cast<size_t>(alloc) % kShadowRatio); | 234 DCHECK_EQ(0u, reinterpret_cast<size_t>(alloc) % kShadowRatio); |
235 BlockInfo block = {}; | 235 BlockInfo block = {}; |
236 BlockInitialize(block_layout, alloc, false, &block); | 236 BlockInitialize(block_layout, alloc, &block); |
237 | 237 |
238 // Poison the redzones in the shadow memory as early as possible. | 238 // Poison the redzones in the shadow memory as early as possible. |
239 shadow_->PoisonAllocatedBlock(block); | 239 shadow_->PoisonAllocatedBlock(block); |
240 | 240 |
241 block.header->alloc_stack = stack_cache_->SaveStackTrace(stack); | 241 block.header->alloc_stack = stack_cache_->SaveStackTrace(stack); |
242 block.header->free_stack = nullptr; | 242 block.header->free_stack = nullptr; |
243 block.header->state = ALLOCATED_BLOCK; | 243 block.header->state = ALLOCATED_BLOCK; |
244 | 244 |
245 block.trailer->heap_id = heap_id; | 245 block.trailer->heap_id = heap_id; |
246 | 246 |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 if (trailer_has_valid_heap_id) | 1112 if (trailer_has_valid_heap_id) |
1113 return block_info->trailer->heap_id; | 1113 return block_info->trailer->heap_id; |
1114 | 1114 |
1115 // Unfortunately, there's no way to know which heap this block belongs to. | 1115 // Unfortunately, there's no way to know which heap this block belongs to. |
1116 return 0; | 1116 return 0; |
1117 } | 1117 } |
1118 | 1118 |
1119 } // namespace heap_managers | 1119 } // namespace heap_managers |
1120 } // namespace asan | 1120 } // namespace asan |
1121 } // namespace agent | 1121 } // namespace agent |
OLD | NEW |