Fix braino in Jit::PostZygoteFork.
The logic for mapping boot image methods after fork is for a child
zygote, so we should check as such (just as the comment mentions).
Not doing the check leads to a race for a forked process with a child
zygote, which if the boot image methods are not yet mapped, it would try
to map them twice.
Test: boots and no crashes in webview forked processes.
Bug: 119800099
Change-Id: I19767d8e3b992e51274e232b41e10a0fe363f284
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 1962ba2..1e7a4faf 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -1697,7 +1697,9 @@
if (thread_pool_ == nullptr) {
// If this is a child zygote, check if we need to remap the boot image
// methods.
- if (fd_methods_ != -1 && code_cache_->GetZygoteMap()->IsCompilationNotified()) {
+ if (Runtime::Current()->IsZygote() &&
+ fd_methods_ != -1 &&
+ code_cache_->GetZygoteMap()->IsCompilationNotified()) {
ScopedSuspendAll ssa(__FUNCTION__);
MapBootImageMethods();
}