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 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 SetProcessStartTime(); | 1463 SetProcessStartTime(); |
1462 | 1464 |
1463 logging::SetDumpWithoutCrashingFunction(&DumpProcess); | 1465 logging::SetDumpWithoutCrashingFunction(&DumpProcess); |
1464 #if defined(ADDRESS_SANITIZER) | 1466 #if defined(ADDRESS_SANITIZER) |
1465 // Register the callback for AddressSanitizer error reporting. | 1467 // Register the callback for AddressSanitizer error reporting. |
1466 __asan_set_error_report_callback(AsanLinuxBreakpadCallback); | 1468 __asan_set_error_report_callback(AsanLinuxBreakpadCallback); |
1467 #endif | 1469 #endif |
1468 } | 1470 } |
1469 | 1471 |
1470 #if defined(OS_ANDROID) | 1472 #if defined(OS_ANDROID) |
1471 void InitNonBrowserCrashReporterForAndroid(int minidump_fd) { | 1473 void InitNonBrowserCrashReporterForAndroid() { |
1472 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1474 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1473 if (command_line->HasSwitch(switches::kEnableCrashReporter)) | 1475 if (command_line->HasSwitch(switches::kEnableCrashReporter)) { |
1474 EnableNonBrowserCrashDumping(minidump_fd); | 1476 // On Android we need to provide a FD to the file where the minidump is |
| 1477 // generated as the renderer and browser run with different UIDs |
| 1478 // (preventing the browser from inspecting the renderer process). |
| 1479 int minidump_fd = base::GlobalDescriptors::GetInstance()-> |
| 1480 MaybeGet(kAndroidMinidumpDescriptor); |
| 1481 if (minidump_fd == base::kInvalidPlatformFileValue) { |
| 1482 NOTREACHED() << "Could not find minidump FD, crash reporting disabled."; |
| 1483 } else { |
| 1484 EnableNonBrowserCrashDumping(minidump_fd); |
| 1485 } |
| 1486 } |
1475 } | 1487 } |
1476 #endif // OS_ANDROID | 1488 #endif // OS_ANDROID |
1477 | 1489 |
1478 bool IsCrashReporterEnabled() { | 1490 bool IsCrashReporterEnabled() { |
1479 return g_is_crash_reporter_enabled; | 1491 return g_is_crash_reporter_enabled; |
1480 } | 1492 } |
OLD | NEW |