OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 #include "chrome/browser/first_run/upgrade_util.h" | 6 #include "chrome/browser/first_run/upgrade_util.h" |
7 #include "components/startup_metric_utils/startup_metric_utils.h" | 7 #include "components/startup_metric_utils/startup_metric_utils.h" |
8 | 8 |
9 // The entry point for all invocations of Chromium, browser and renderer. On | 9 // The entry point for all invocations of Chromium, browser and renderer. On |
10 // windows, this does nothing but load chrome.dll and invoke its entry point in | 10 // windows, this does nothing but load chrome.dll and invoke its entry point in |
11 // order to make it easy to update the app from GoogleUpdate. We don't need | 11 // order to make it easy to update the app from GoogleUpdate. We don't need |
12 // that extra layer with on linux. | 12 // that extra layer with on linux. |
13 | 13 |
| 14 #if defined(ADDRESS_SANITIZER) && defined(GOOGLE_CHROME_BUILD) |
| 15 // Default AddressSanitizer options for the official build. These do not affect |
| 16 // tests or non-official Chromium builds. |
| 17 // - disable the strict memcmp() checking (http://crbug.com/178677 and |
| 18 // http://crbug.com/178404). |
| 19 // - set the malloc_context_size (i.e. the size of stack traces collected by |
| 20 // ASan for each malloc/free) to 5. These stack traces tend to accumulate |
| 21 // very fast in applications using JIT (v8 in Chrome's case), see |
| 22 // https://code.google.com/p/address-sanitizer/issues/detail?id=177 |
| 23 // - disable the in-process symbolization, which isn't 100% compatible with |
| 24 // the existing sandboxes and doesn't make much sense for stripped official |
| 25 // binaries. |
| 26 const char *kAsanDefaultOptions = |
| 27 "malloc_context_size=5 strict_memcmp=0 symbolize=false"; |
| 28 |
| 29 // Override the default ASan options for the Google Chrome executable. |
| 30 // __asan_default_options should not be instrumented, because it is called |
| 31 // before ASan is initialized. |
| 32 extern "C" |
| 33 __attribute__((no_sanitize_address)) |
| 34 const char *__asan_default_options() { |
| 35 return kAsanDefaultOptions; |
| 36 } |
| 37 #endif |
| 38 |
14 extern "C" { | 39 extern "C" { |
15 int ChromeMain(int argc, const char** argv); | 40 int ChromeMain(int argc, const char** argv); |
16 } | 41 } |
17 | 42 |
18 int main(int argc, const char** argv) { | 43 int main(int argc, const char** argv) { |
19 startup_metric_utils::RecordExeMainEntryTime(); | 44 startup_metric_utils::RecordExeMainEntryTime(); |
20 int return_code = ChromeMain(argc, argv); | 45 int return_code = ChromeMain(argc, argv); |
21 | 46 |
22 #if defined(OS_LINUX) | 47 #if defined(OS_LINUX) |
23 // Launch a new instance if we're shutting down because we detected an | 48 // Launch a new instance if we're shutting down because we detected an |
24 // upgrade in the persistent mode. | 49 // upgrade in the persistent mode. |
25 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 50 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
26 #endif | 51 #endif |
27 | 52 |
28 return return_code; | 53 return return_code; |
29 } | 54 } |
OLD | NEW |