Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Unified Diff: third_party/crashpad/crashpad/util/mach/mach_extensions.cc

Issue 2555353002: Update Crashpad to 32981a3ee9d7c2769fb27afa038fe2e194cfa329 (Closed)
Patch Set: fix readme Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/crashpad/crashpad/util/mach/mach_extensions.cc
diff --git a/third_party/crashpad/crashpad/util/mach/mach_extensions.cc b/third_party/crashpad/crashpad/util/mach/mach_extensions.cc
index 64552f1cba65ce1d7edad926e40cc58dc289b379..eb4e330e50054640899d1c4b49f9be173b6b4119 100644
--- a/third_party/crashpad/crashpad/util/mach/mach_extensions.cc
+++ b/third_party/crashpad/crashpad/util/mach/mach_extensions.cc
@@ -157,7 +157,26 @@ base::mac::ScopedMachReceiveRight BootstrapCheckIn(
base::mac::ScopedMachSendRight BootstrapLookUp(
const std::string& service_name) {
- return BootstrapCheckInOrLookUp<BootstrapLookUpTraits>(service_name);
+ base::mac::ScopedMachSendRight send(
+ BootstrapCheckInOrLookUp<BootstrapLookUpTraits>(service_name));
+
+ // It’s possible to race the bootstrap server when the receive right
+ // corresponding to the looked-up send right is destroyed immediately before
+ // the bootstrap_look_up() call. If the bootstrap server believes that
+ // |service_name| is still registered before processing the port-destroyed
+ // notification sent to it by the kernel, it will respond to a
+ // bootstrap_look_up() request with a send right that has become a dead name,
+ // which will be returned to the bootstrap_look_up() caller, translated into
+ // the caller’s IPC port name space, as the special MACH_PORT_DEAD port name.
+ // Check for that and return MACH_PORT_NULL in its place, as though the
+ // bootstrap server had fully processed the port-destroyed notification before
+ // responding to bootstrap_look_up().
+ if (send.get() == MACH_PORT_DEAD) {
+ LOG(ERROR) << "bootstrap_look_up " << service_name << ": service is dead";
+ send.reset();
+ }
+
+ return send;
}
base::mac::ScopedMachSendRight SystemCrashReporterHandler() {

Powered by Google App Engine
This is Rietveld 408576698