| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // The maximum number of frames which CaptureStackBackTrace can be asked | 146 // The maximum number of frames which CaptureStackBackTrace can be asked |
| 147 // to traverse must be less than 63, so this can't be any larger than 62. | 147 // to traverse must be less than 63, so this can't be any larger than 62. |
| 148 const uint32_t kDefaultMaxNumFrames = 62; | 148 const uint32_t kDefaultMaxNumFrames = 62; |
| 149 | 149 |
| 150 // Default values of AsanRuntime parameters. | 150 // Default values of AsanRuntime parameters. |
| 151 const bool kDefaultExitOnFailure = false; | 151 const bool kDefaultExitOnFailure = false; |
| 152 const bool kDefaultCheckHeapOnFailure = true; | 152 const bool kDefaultCheckHeapOnFailure = true; |
| 153 const bool kDefaultDisableBreakpadReporting = false; | 153 const bool kDefaultDisableBreakpadReporting = false; |
| 154 const bool kDefaultFeatureRandomization = false; | 154 const bool kDefaultFeatureRandomization = false; |
| 155 const bool kDefaultReportInvalidAccesses = false; | 155 const bool kDefaultReportInvalidAccesses = false; |
| 156 const bool kDefaultDeferCrashReporterInitialization = false; |
| 156 | 157 |
| 157 // Default values of AsanLogger parameters. | 158 // Default values of AsanLogger parameters. |
| 158 const bool kDefaultMiniDumpOnFailure = false; | 159 const bool kDefaultMiniDumpOnFailure = false; |
| 159 const bool kDefaultLogAsText = true; | 160 const bool kDefaultLogAsText = true; |
| 160 | 161 |
| 161 // Default values of ZebraBlockHeap parameters. | 162 // Default values of ZebraBlockHeap parameters. |
| 162 const uint32_t kDefaultZebraBlockHeapSize = 16 * 1024 * 1024; | 163 const uint32_t kDefaultZebraBlockHeapSize = 16 * 1024 * 1024; |
| 163 const float kDefaultZebraBlockHeapQuarantineRatio = 0.25f; | 164 const float kDefaultZebraBlockHeapQuarantineRatio = 0.25f; |
| 164 | 165 |
| 165 // Default values of the BlockHeapManager parameters. | 166 // Default values of the BlockHeapManager parameters. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 191 // String names of StackCapture parameters. | 192 // String names of StackCapture parameters. |
| 192 const char kParamMaxNumFrames[] = "max_num_frames"; | 193 const char kParamMaxNumFrames[] = "max_num_frames"; |
| 193 | 194 |
| 194 // String names of AsanRuntime parameters. | 195 // String names of AsanRuntime parameters. |
| 195 const char kParamIgnoredStackIds[] = "ignored_stack_ids"; | 196 const char kParamIgnoredStackIds[] = "ignored_stack_ids"; |
| 196 const char kParamExitOnFailure[] = "exit_on_failure"; | 197 const char kParamExitOnFailure[] = "exit_on_failure"; |
| 197 const char kParamNoCheckHeapOnFailure[] = "no_check_heap_on_failure"; | 198 const char kParamNoCheckHeapOnFailure[] = "no_check_heap_on_failure"; |
| 198 const char kParamDisableBreakpadReporting[] = "disable_breakpad"; | 199 const char kParamDisableBreakpadReporting[] = "disable_breakpad"; |
| 199 const char kParamFeatureRandomization[] = "feature_randomization"; | 200 const char kParamFeatureRandomization[] = "feature_randomization"; |
| 200 const char kParamReportInvalidAccesses[] = "report_invalid_accesses"; | 201 const char kParamReportInvalidAccesses[] = "report_invalid_accesses"; |
| 202 const char kParamDeferCrashReporterInitialization[] = |
| 203 "defer_crash_reporter_initialization"; |
| 201 | 204 |
| 202 // String names of AsanLogger parameters. | 205 // String names of AsanLogger parameters. |
| 203 const char kParamMiniDumpOnFailure[] = "minidump_on_failure"; | 206 const char kParamMiniDumpOnFailure[] = "minidump_on_failure"; |
| 204 const char kParamNoLogAsText[] = "no_log_as_text"; | 207 const char kParamNoLogAsText[] = "no_log_as_text"; |
| 205 | 208 |
| 206 // String names of ZebraBlockHeap parameters. | 209 // String names of ZebraBlockHeap parameters. |
| 207 const char kParamZebraBlockHeapSize[] = "zebra_block_heap_size"; | 210 const char kParamZebraBlockHeapSize[] = "zebra_block_heap_size"; |
| 208 const char kParamZebraBlockHeapQuarantineRatio[] = | 211 const char kParamZebraBlockHeapQuarantineRatio[] = |
| 209 "zebra_block_heap_quarantine_ratio"; | 212 "zebra_block_heap_quarantine_ratio"; |
| 210 | 213 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 asan_parameters->enable_large_block_heap = kDefaultEnableLargeBlockHeap; | 298 asan_parameters->enable_large_block_heap = kDefaultEnableLargeBlockHeap; |
| 296 asan_parameters->enable_allocation_filter = kDefaultEnableAllocationFilter; | 299 asan_parameters->enable_allocation_filter = kDefaultEnableAllocationFilter; |
| 297 asan_parameters->large_allocation_threshold = | 300 asan_parameters->large_allocation_threshold = |
| 298 kDefaultLargeAllocationThreshold; | 301 kDefaultLargeAllocationThreshold; |
| 299 asan_parameters->feature_randomization = kDefaultFeatureRandomization; | 302 asan_parameters->feature_randomization = kDefaultFeatureRandomization; |
| 300 asan_parameters->quarantine_flood_fill_rate = | 303 asan_parameters->quarantine_flood_fill_rate = |
| 301 kDefaultQuarantineFloodFillRate; | 304 kDefaultQuarantineFloodFillRate; |
| 302 asan_parameters->prevent_duplicate_corruption_crashes = | 305 asan_parameters->prevent_duplicate_corruption_crashes = |
| 303 kDefaultPreventDuplicateCorruptionCrashes; | 306 kDefaultPreventDuplicateCorruptionCrashes; |
| 304 asan_parameters->report_invalid_accesses = kDefaultReportInvalidAccesses; | 307 asan_parameters->report_invalid_accesses = kDefaultReportInvalidAccesses; |
| 308 asan_parameters->defer_crash_reporter_initialization = |
| 309 kDefaultDeferCrashReporterInitialization; |
| 305 } | 310 } |
| 306 | 311 |
| 307 bool InflateAsanParameters(const AsanParameters* pod_params, | 312 bool InflateAsanParameters(const AsanParameters* pod_params, |
| 308 InflatedAsanParameters* inflated_params) { | 313 InflatedAsanParameters* inflated_params) { |
| 309 // This must be kept up to date with AsanParameters as it evolves. | 314 // This must be kept up to date with AsanParameters as it evolves. |
| 310 static const size_t kSizeOfAsanParametersByVersion[] = { | 315 static const size_t kSizeOfAsanParametersByVersion[] = { |
| 311 40, 44, 48, 52, 52, 52, 56, 56, 56, 56, 60, 60, 60, 60, 60}; | 316 40, 44, 48, 52, 52, 52, 56, 56, 56, 56, 60, 60, 60, 60, 60, 60}; |
| 312 static_assert( | 317 static_assert( |
| 313 arraysize(kSizeOfAsanParametersByVersion) == kAsanParametersVersion + 1, | 318 arraysize(kSizeOfAsanParametersByVersion) == kAsanParametersVersion + 1, |
| 314 "Size of parameters version out of date."); | 319 "Size of parameters version out of date."); |
| 315 | 320 |
| 316 SetDefaultAsanParameters(inflated_params); | 321 SetDefaultAsanParameters(inflated_params); |
| 317 | 322 |
| 318 const uint8_t* data = reinterpret_cast<const uint8_t*>(pod_params); | 323 const uint8_t* data = reinterpret_cast<const uint8_t*>(pod_params); |
| 319 const uint8_t* data_end = data + pod_params->size; | 324 const uint8_t* data_end = data + pod_params->size; |
| 320 | 325 |
| 321 // This is the size of known POD data in the version of the structure | 326 // This is the size of known POD data in the version of the structure |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 if (cmd_line.HasSwitch(kParamEnableZebraBlockHeap)) | 510 if (cmd_line.HasSwitch(kParamEnableZebraBlockHeap)) |
| 506 asan_parameters->enable_zebra_block_heap = true; | 511 asan_parameters->enable_zebra_block_heap = true; |
| 507 if (cmd_line.HasSwitch(kParamDisableLargeBlockHeap)) | 512 if (cmd_line.HasSwitch(kParamDisableLargeBlockHeap)) |
| 508 asan_parameters->enable_large_block_heap = false; | 513 asan_parameters->enable_large_block_heap = false; |
| 509 if (cmd_line.HasSwitch(kParamEnableAllocationFilter)) | 514 if (cmd_line.HasSwitch(kParamEnableAllocationFilter)) |
| 510 asan_parameters->enable_allocation_filter = true; | 515 asan_parameters->enable_allocation_filter = true; |
| 511 if (cmd_line.HasSwitch(kParamPreventDuplicateCorruptionCrashes)) | 516 if (cmd_line.HasSwitch(kParamPreventDuplicateCorruptionCrashes)) |
| 512 asan_parameters->prevent_duplicate_corruption_crashes = true; | 517 asan_parameters->prevent_duplicate_corruption_crashes = true; |
| 513 if (cmd_line.HasSwitch(kParamReportInvalidAccesses)) | 518 if (cmd_line.HasSwitch(kParamReportInvalidAccesses)) |
| 514 asan_parameters->report_invalid_accesses = true; | 519 asan_parameters->report_invalid_accesses = true; |
| 520 if (cmd_line.HasSwitch(kParamDeferCrashReporterInitialization)) |
| 521 asan_parameters->defer_crash_reporter_initialization = true; |
| 515 | 522 |
| 516 // New style boolean flags with both positive and negative setters. This | 523 // New style boolean flags with both positive and negative setters. This |
| 517 // allows them to be set one way in the baked in configuration, and set | 524 // allows them to be set one way in the baked in configuration, and set |
| 518 // another way in the environment specified runtime configuration. | 525 // another way in the environment specified runtime configuration. |
| 519 bool value = false; | 526 bool value = false; |
| 520 if (ParseBooleanFlag(kParamFeatureRandomization, cmd_line, &value)) | 527 if (ParseBooleanFlag(kParamFeatureRandomization, cmd_line, &value)) |
| 521 asan_parameters->feature_randomization = value; | 528 asan_parameters->feature_randomization = value; |
| 522 | 529 |
| 523 return true; | 530 return true; |
| 524 } | 531 } |
| 525 | 532 |
| 526 } // namespace common | 533 } // namespace common |
| OLD | NEW |