Add flock(2)ing on dex-cache files to prevent races

Bug: 9071417
Change-Id: I1ee9ff281867f90fba7a8ed8bbf06b33ac29d511
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc
index 6b8c41e..bf0fffa 100644
--- a/runtime/entrypoints/entrypoint_utils.cc
+++ b/runtime/entrypoints/entrypoint_utils.cc
@@ -269,7 +269,10 @@
 }
 
 void ThrowStackOverflowError(Thread* self) {
-  CHECK(!self->IsHandlingStackOverflow()) << "Recursive stack overflow.";
+  if (self->IsHandlingStackOverflow()) {
+      LOG(ERROR) << "Recursive stack overflow.";
+      // We don't fail here because SetStackEndForStackOverflow will print better diagnostics.
+  }
 
   if (Runtime::Current()->GetInstrumentation()->AreExitStubsInstalled()) {
     // Remove extra entry pushed onto second stack during method tracing.