Index: content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java |
index db41c53b09b79d4e1299e10b62187c6ecb13bb92..a47ab89100f7f9482b009c48a8fbe89f05597412 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java |
@@ -4,6 +4,7 @@ |
package org.chromium.content.browser; |
+import android.os.Bundle; |
bulach
2013/09/09 16:14:15
nit: sort order
digit1
2013/09/10 09:23:30
Done.
|
import android.content.Context; |
import android.util.Log; |
import android.util.SparseIntArray; |
@@ -15,8 +16,10 @@ import java.util.concurrent.ConcurrentHashMap; |
import org.chromium.base.CalledByNative; |
import org.chromium.base.JNINamespace; |
+import org.chromium.base.Linker; |
import org.chromium.base.ThreadUtils; |
import org.chromium.content.app.ChildProcessService; |
+import org.chromium.content.app.LibraryLoader; |
import org.chromium.content.app.PrivilegedProcessService; |
import org.chromium.content.app.SandboxedProcessService; |
import org.chromium.content.common.IChildProcessCallback; |
@@ -175,6 +178,10 @@ public class ChildProcessLauncher { |
private static Map<Integer, ChildProcessConnection> sServiceMap = |
new ConcurrentHashMap<Integer, ChildProcessConnection>(); |
+ // Bundle from Linker.getRelroBundle(), to be sent to each service once |
+ // setRelroBundle() is called. |
+ private static Bundle sRelroBundle = null; |
+ |
// Map from pid to the count of oom bindings. "Oom binding" is a binding that raises the process |
// oom priority so that it shouldn't be killed by the OS out-of-memory killer under normal |
// conditions (it can still be killed under drastic memory pressure). |
@@ -208,12 +215,28 @@ public class ChildProcessLauncher { |
public static void warmUp(Context context) { |
synchronized (ChildProcessLauncher.class) { |
assert !ThreadUtils.runningOnUiThread(); |
+ if (LibraryLoader.useCrazyLinker()) { |
+ // Initialization of the relro sharing must happen before any process is started. |
+ Linker.initRelroSharing(); |
+ } |
if (sSpareSandboxedConnection == null) { |
sSpareSandboxedConnection = allocateBoundConnection(context, null, true); |
} |
} |
} |
+ public static void setRelroBundle(Bundle bundle) { |
+ synchronized (ChildProcessLauncher.class) { |
+ sRelroBundle = bundle; |
+ if (bundle != null) { |
+ for (Map.Entry<Integer, ChildProcessConnection> entry : sServiceMap.entrySet()) { |
+ ChildProcessConnection connection = entry.getValue(); |
+ connection.applyRelro(bundle); |
+ } |
+ } |
+ } |
+ } |
+ |
private static String getSwitchValue(final String[] commandLine, String switchKey) { |
if (commandLine == null || switchKey == null) { |
return null; |
@@ -294,6 +317,9 @@ public class ChildProcessLauncher { |
if (pid != NULL_PROCESS_HANDLE) { |
sOomBindingCount.put(pid, oomBindingCount); |
sServiceMap.put(pid, connection); |
+ |
+ if (sRelroBundle != null) |
+ connection.applyRelro(sRelroBundle); |
} else { |
freeConnection(connection); |
} |