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 | 7 |
8 // The entry point for all invocations of Chromium, browser and renderer. On | 8 // The entry point for all invocations of Chromium, browser and renderer. On |
9 // windows, this does nothing but load chrome.dll and invoke its entry point in | 9 // windows, this does nothing but load chrome.dll and invoke its entry point in |
10 // order to make it easy to update the app from GoogleUpdate. We don't need | 10 // order to make it easy to update the app from GoogleUpdate. We don't need |
11 // that extra layer with on linux. | 11 // that extra layer with on linux. |
12 | 12 |
13 #if defined(ADDRESS_SANITIZER) && defined(GOOGLE_CHROME_BUILD) | 13 #if defined(ADDRESS_SANITIZER) && defined(GOOGLE_CHROME_BUILD) |
14 // Default AddressSanitizer options: limit the quarantine to 1Gb, disable the | 14 // Default AddressSanitizer options for the official build. These do not affect |
15 // strict memcmp() checking (http://crbug.com/178677 and | 15 // tests or non-official Chromium builds. |
16 // http://crbug.com/178404). | 16 // - disable the strict memcmp() checking (http://crbug.com/178677 and |
17 const char *kAsanDefaultOptions = "quarantine_size=1048576 strict_memcmp=0"; | 17 // http://crbug.com/178404). |
| 18 // - set the malloc_context_size (i.e. the size of stack traces collected by |
| 19 // ASan for each malloc/free) to 5. These stack traces tend to accumulate |
| 20 // very fast in applications using JIT (v8 in Chrome's case), see |
| 21 // https://code.google.com/p/address-sanitizer/issues/detail?id=177 |
| 22 const char *kAsanDefaultOptions = "malloc_context_size=5 strict_memcmp=0"; |
18 | 23 |
19 // Override the default ASan options for the Google Chrome executable. | 24 // Override the default ASan options for the Google Chrome executable. |
20 // __asan_default_options should not be instrumented, because it is called | 25 // __asan_default_options should not be instrumented, because it is called |
21 // before ASan is initialized. | 26 // before ASan is initialized. |
22 extern "C" | 27 extern "C" |
23 __attribute__((no_address_safety_analysis)) | 28 __attribute__((no_address_safety_analysis)) |
24 const char *__asan_default_options() { | 29 const char *__asan_default_options() { |
25 return kAsanDefaultOptions; | 30 return kAsanDefaultOptions; |
26 } | 31 } |
27 #endif | 32 #endif |
28 | 33 |
29 extern "C" { | 34 extern "C" { |
30 int ChromeMain(int argc, const char** argv); | 35 int ChromeMain(int argc, const char** argv); |
31 } | 36 } |
32 | 37 |
33 int main(int argc, const char** argv) { | 38 int main(int argc, const char** argv) { |
34 int return_code = ChromeMain(argc, argv); | 39 int return_code = ChromeMain(argc, argv); |
35 | 40 |
36 #if defined(OS_LINUX) | 41 #if defined(OS_LINUX) |
37 // Launch a new instance if we're shutting down because we detected an | 42 // Launch a new instance if we're shutting down because we detected an |
38 // upgrade in the persistent mode. | 43 // upgrade in the persistent mode. |
39 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 44 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
40 #endif | 45 #endif |
41 | 46 |
42 return return_code; | 47 return return_code; |
43 } | 48 } |
OLD | NEW |