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 // For linux_syscall_support.h. This makes it safe to call embedded system | 5 // For linux_syscall_support.h. This makes it safe to call embedded system |
6 // calls when in seccomp mode. | 6 // calls when in seccomp mode. |
7 #define SYS_SYSCALL_ENTRYPOINT "playground$syscallEntryPoint" | 7 #define SYS_SYSCALL_ENTRYPOINT "playground$syscallEntryPoint" |
8 | 8 |
9 #include "chrome/app/breakpad_linux.h" | 9 #include "chrome/app/breakpad_linux.h" |
10 | 10 |
11 #include <fcntl.h> | 11 #include <fcntl.h> |
12 #include <poll.h> | 12 #include <poll.h> |
13 #include <signal.h> | 13 #include <signal.h> |
14 #include <stdlib.h> | 14 #include <stdlib.h> |
15 #include <sys/socket.h> | 15 #include <sys/socket.h> |
16 #include <sys/time.h> | 16 #include <sys/time.h> |
17 #include <sys/types.h> | 17 #include <sys/types.h> |
18 #include <sys/wait.h> | 18 #include <sys/wait.h> |
19 #include <sys/uio.h> | 19 #include <sys/uio.h> |
20 #include <time.h> | 20 #include <time.h> |
21 #include <unistd.h> | 21 #include <unistd.h> |
22 | 22 |
23 #include <algorithm> | 23 #include <algorithm> |
24 #include <string> | 24 #include <string> |
25 | 25 |
26 #include "base/command_line.h" | 26 #include "base/command_line.h" |
27 #include "base/file_path.h" | 27 #include "base/file_path.h" |
28 #include "base/linux_util.h" | 28 #include "base/linux_util.h" |
29 #include "base/path_service.h" | 29 #include "base/path_service.h" |
| 30 #include "base/platform_file.h" |
30 #include "base/posix/eintr_wrapper.h" | 31 #include "base/posix/eintr_wrapper.h" |
31 #include "base/posix/global_descriptors.h" | 32 #include "base/posix/global_descriptors.h" |
32 #include "base/process_util.h" | 33 #include "base/process_util.h" |
33 #include "base/string_util.h" | 34 #include "base/string_util.h" |
34 #include "breakpad/src/client/linux/handler/exception_handler.h" | 35 #include "breakpad/src/client/linux/handler/exception_handler.h" |
35 #include "breakpad/src/client/linux/minidump_writer/directory_reader.h" | 36 #include "breakpad/src/client/linux/minidump_writer/directory_reader.h" |
36 #include "breakpad/src/common/linux/linux_libc_support.h" | 37 #include "breakpad/src/common/linux/linux_libc_support.h" |
37 #include "breakpad/src/common/memory.h" | 38 #include "breakpad/src/common/memory.h" |
38 #include "chrome/browser/crash_upload_list.h" | 39 #include "chrome/browser/crash_upload_list.h" |
39 #include "chrome/common/child_process_logging.h" | 40 #include "chrome/common/child_process_logging.h" |
40 #include "chrome/common/chrome_paths.h" | 41 #include "chrome/common/chrome_paths.h" |
41 #include "chrome/common/chrome_switches.h" | 42 #include "chrome/common/chrome_switches.h" |
42 #include "chrome/common/chrome_version_info_posix.h" | 43 #include "chrome/common/chrome_version_info_posix.h" |
43 #include "chrome/common/env_vars.h" | 44 #include "chrome/common/env_vars.h" |
44 #include "chrome/common/logging_chrome.h" | 45 #include "chrome/common/logging_chrome.h" |
45 #include "content/public/common/content_descriptors.h" | 46 #include "content/public/common/content_descriptors.h" |
46 | 47 |
47 #if defined(OS_ANDROID) | 48 #if defined(OS_ANDROID) |
48 #include <android/log.h> | 49 #include <android/log.h> |
49 #include <sys/stat.h> | 50 #include <sys/stat.h> |
50 | 51 |
51 #include "base/android/build_info.h" | 52 #include "base/android/build_info.h" |
52 #include "base/android/path_utils.h" | 53 #include "base/android/path_utils.h" |
| 54 #include "chrome/common/descriptors_android.h" |
53 #include "third_party/lss/linux_syscall_support.h" | 55 #include "third_party/lss/linux_syscall_support.h" |
54 #else | 56 #else |
55 #include "sandbox/linux/seccomp-legacy/linux_syscall_support.h" | 57 #include "sandbox/linux/seccomp-legacy/linux_syscall_support.h" |
56 #endif | 58 #endif |
57 | 59 |
58 #if defined(ADDRESS_SANITIZER) | 60 #if defined(ADDRESS_SANITIZER) |
59 #include <ucontext.h> // for getcontext(). | 61 #include <ucontext.h> // for getcontext(). |
60 #endif | 62 #endif |
61 | 63 |
62 #if defined(OS_ANDROID) | 64 #if defined(OS_ANDROID) |
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 SetProcessStartTime(); | 1452 SetProcessStartTime(); |
1451 | 1453 |
1452 logging::SetDumpWithoutCrashingFunction(&DumpProcess); | 1454 logging::SetDumpWithoutCrashingFunction(&DumpProcess); |
1453 #if defined(ADDRESS_SANITIZER) | 1455 #if defined(ADDRESS_SANITIZER) |
1454 // Register the callback for AddressSanitizer error reporting. | 1456 // Register the callback for AddressSanitizer error reporting. |
1455 __asan_set_error_report_callback(AsanLinuxBreakpadCallback); | 1457 __asan_set_error_report_callback(AsanLinuxBreakpadCallback); |
1456 #endif | 1458 #endif |
1457 } | 1459 } |
1458 | 1460 |
1459 #if defined(OS_ANDROID) | 1461 #if defined(OS_ANDROID) |
1460 void InitNonBrowserCrashReporterForAndroid(int minidump_fd) { | 1462 void InitNonBrowserCrashReporterForAndroid() { |
1461 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1463 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1462 if (command_line->HasSwitch(switches::kEnableCrashReporter)) | 1464 if (command_line->HasSwitch(switches::kEnableCrashReporter)) { |
1463 EnableNonBrowserCrashDumping(minidump_fd); | 1465 // On Android we need to provide a FD to the file where the minidump is |
| 1466 // generated as the renderer and browser run with different UIDs |
| 1467 // (preventing the browser from inspecting the renderer process). |
| 1468 int minidump_fd = base::GlobalDescriptors::GetInstance()-> |
| 1469 MaybeGet(kAndroidMinidumpDescriptor); |
| 1470 if (minidump_fd == base::kInvalidPlatformFileValue) { |
| 1471 NOTREACHED() << "Could not find minidump FD, crash reporting disabled."; |
| 1472 } else { |
| 1473 EnableNonBrowserCrashDumping(minidump_fd); |
| 1474 } |
| 1475 } |
1464 } | 1476 } |
1465 #endif // OS_ANDROID | 1477 #endif // OS_ANDROID |
1466 | 1478 |
1467 bool IsCrashReporterEnabled() { | 1479 bool IsCrashReporterEnabled() { |
1468 return g_is_crash_reporter_enabled; | 1480 return g_is_crash_reporter_enabled; |
1469 } | 1481 } |
OLD | NEW |