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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java

Issue 23717023: Android: Add chrome-specific dynamic linker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove findbugs issues. Created 7 years, 3 months 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: 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);
}

Powered by Google App Engine
This is Rietveld 408576698