Skip to content

Commit

Permalink
Merge pull request #339 from Artur96/develop
Browse files Browse the repository at this point in the history
Patch for disabling crashpad handler on macOS

Fixes #315
  • Loading branch information
Eloston committed Feb 27, 2018
2 parents e8a903a + ef3a530 commit 86104f9
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 1 deletion.
3 changes: 2 additions & 1 deletion resources/config_bundles/macos/patch_order.list
@@ -1,6 +1,7 @@
ungoogled-chromium/macos/disable-symbol-order-verification.patch
ungoogled-chromium/macos/disable-crashpad-handler.patch
ungoogled-chromium/macos/add-trknotify-gn-dependency.patch
ungoogled-chromium/macos/fix-gn-bootstrap.patch
ungoogled-chromium/macos/fix-gn-safe_browsing.patch
ungoogled-chromium/macos/fix-mapped_file.patch
ungoogled-chromium/macos/fix-visibility.patch
ungoogled-chromium/macos/fix-visibility.patch
@@ -0,0 +1,92 @@
# Disables crashpad_handler process

--- a/third_party/crashpad/crashpad/client/crashpad_client_mac.cc
+++ b/third_party/crashpad/crashpad/client/crashpad_client_mac.cc
@@ -123,61 +123,7 @@ class HandlerStarter final : public Noti
const std::map<std::string, std::string>& annotations,
const std::vector<std::string>& arguments,
bool restartable) {
- base::mac::ScopedMachReceiveRight receive_right(
- NewMachPort(MACH_PORT_RIGHT_RECEIVE));
- if (!receive_right.is_valid()) {
- return base::mac::ScopedMachSendRight();
- }
-
- mach_port_t port;
- mach_msg_type_name_t right_type;
- kern_return_t kr = mach_port_extract_right(mach_task_self(),
- receive_right.get(),
- MACH_MSG_TYPE_MAKE_SEND,
- &port,
- &right_type);
- if (kr != KERN_SUCCESS) {
- MACH_LOG(ERROR, kr) << "mach_port_extract_right";
- return base::mac::ScopedMachSendRight();
- }
- base::mac::ScopedMachSendRight send_right(port);
- DCHECK_EQ(port, receive_right.get());
- DCHECK_EQ(right_type,
- implicit_cast<mach_msg_type_name_t>(MACH_MSG_TYPE_PORT_SEND));
-
- std::unique_ptr<HandlerStarter> handler_restarter;
- if (restartable) {
- handler_restarter.reset(new HandlerStarter());
- if (!handler_restarter->notify_port_.is_valid()) {
- // This is an error that NewMachPort() would have logged. Proceed anyway
- // without the ability to restart.
- handler_restarter.reset();
- }
- }
-
- if (!CommonStart(handler,
- database,
- metrics_dir,
- url,
- annotations,
- arguments,
- std::move(receive_right),
- handler_restarter.get(),
- false)) {
- return base::mac::ScopedMachSendRight();
- }
-
- if (handler_restarter &&
- handler_restarter->StartRestartThread(
- handler, database, metrics_dir, url, annotations, arguments)) {
- // The thread owns the object now.
- ignore_result(handler_restarter.release());
- }
-
- // If StartRestartThread() failed, proceed without the ability to restart.
- // handler_restarter will be released when this function returns.
-
- return send_right;
+ return base::mac::ScopedMachSendRight();
}

// NotifyServer::DefaultInterface:
@@ -456,23 +402,7 @@ bool CrashpadClient::StartHandler(
const std::vector<std::string>& arguments,
bool restartable,
bool asynchronous_start) {
- // The “restartable” behavior can only be selected on OS X 10.10 and later. In
- // previous OS versions, if the initial client were to crash while attempting
- // to restart the handler, it would become an unkillable process.
- base::mac::ScopedMachSendRight exception_port(
- HandlerStarter::InitialStart(handler,
- database,
- metrics_dir,
- url,
- annotations,
- arguments,
- restartable && MacOSXMinorVersion() >= 10));
- if (!exception_port.is_valid()) {
- return false;
- }
-
- SetHandlerMachPort(std::move(exception_port));
- return true;
+ return false;
}

bool CrashpadClient::SetHandlerMachService(const std::string& service_name) {

0 comments on commit 86104f9

Please sign in to comment.