Commit e03f02cf authored by Egor Pasko's avatar Egor Pasko Committed by Commit Bot

base/android: remove unused parts of ChromiumLinkerParams

This was used for fancy ways to test the chromium native linkers (should
have been named "native library loaders") outside of the systems and
modes they normally support, which created more moving parts, so we
removed those tests a year ago or so. This change removes a few
remainders of those tests that were not removed earlier, supposedly by
mistake.

Bug: 979638
Change-Id: Icda19a37e621659a1437a7f80a08d76bc514bfe3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2554980Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830974}
parent a09f6c74
...@@ -108,7 +108,7 @@ class LegacyLinker extends Linker { ...@@ -108,7 +108,7 @@ class LegacyLinker extends Linker {
* Native method used to add a zip archive or APK to the search path * Native method used to add a zip archive or APK to the search path
* for native libraries. Allows loading directly from it. * for native libraries. Allows loading directly from it.
* *
* @param zipfilePath Path of the zip file containing the libraries. * @param zipFilePath Path of the zip file containing the libraries.
* @return true for success, false otherwise. * @return true for success, false otherwise.
*/ */
private static native boolean nativeAddZipArchivePath(String zipFilePath); private static native boolean nativeAddZipArchivePath(String zipFilePath);
......
...@@ -98,7 +98,7 @@ import javax.annotation.concurrent.GuardedBy; ...@@ -98,7 +98,7 @@ import javax.annotation.concurrent.GuardedBy;
* *
* - The browser is in charge of deciding where in memory each library should * - The browser is in charge of deciding where in memory each library should
* be loaded. This address must be passed to each service process (see * be loaded. This address must be passed to each service process (see
* ChromiumLinkerParams.java in //content for a helper class to do so). * {@link org.chromium.content.app.ChromiumLinkerParams} for a helper class to do so).
* *
* - The browser will also generate shared RELRO for the loaded library. * - The browser will also generate shared RELRO for the loaded library.
* *
......
...@@ -20,45 +20,11 @@ public class ChromiumLinkerParams { ...@@ -20,45 +20,11 @@ public class ChromiumLinkerParams {
// Use this base address to load native shared libraries. If 0, ignore other members. // Use this base address to load native shared libraries. If 0, ignore other members.
public final long mBaseLoadAddress; public final long mBaseLoadAddress;
// If true, wait for a shared RELRO Bundle just after loading the libraries.
public final boolean mWaitForSharedRelro;
// If not empty, name of Linker.TestRunner implementation that needs to be
// registered in the service process.
public final String mTestRunnerClassNameForTesting;
// If mTestRunnerClassNameForTesting is not empty, the Linker implementation
// to force for testing.
public final int mLinkerImplementationForTesting;
private static final String EXTRA_LINKER_PARAMS_BASE_LOAD_ADDRESS = private static final String EXTRA_LINKER_PARAMS_BASE_LOAD_ADDRESS =
"org.chromium.content.common.linker_params.base_load_address"; "org.chromium.content.common.linker_params.base_load_address";
private static final String EXTRA_LINKER_PARAMS_WAIT_FOR_SHARED_RELRO = public ChromiumLinkerParams(long baseLoadAddress) {
"org.chromium.content.common.linker_params.wait_for_shared_relro";
private static final String EXTRA_LINKER_PARAMS_TEST_RUNNER_CLASS_NAME =
"org.chromium.content.common.linker_params.test_runner_class_name";
private static final String EXTRA_LINKER_PARAMS_LINKER_IMPLEMENTATION =
"org.chromium.content.common.linker_params.linker_implementation";
public ChromiumLinkerParams(long baseLoadAddress, boolean waitForSharedRelro) {
mBaseLoadAddress = baseLoadAddress;
mWaitForSharedRelro = waitForSharedRelro;
mTestRunnerClassNameForTesting = null;
mLinkerImplementationForTesting = 0;
}
/**
* Use this constructor to create a LinkerParams instance for testing.
*/
public ChromiumLinkerParams(long baseLoadAddress, boolean waitForSharedRelro,
String testRunnerClassName, int linkerImplementation) {
mBaseLoadAddress = baseLoadAddress; mBaseLoadAddress = baseLoadAddress;
mWaitForSharedRelro = waitForSharedRelro;
mTestRunnerClassNameForTesting = testRunnerClassName;
mLinkerImplementationForTesting = linkerImplementation;
} }
/** /**
...@@ -69,22 +35,12 @@ public class ChromiumLinkerParams { ...@@ -69,22 +35,12 @@ public class ChromiumLinkerParams {
* @return params instance or possibly null if params was not put into bundle. * @return params instance or possibly null if params was not put into bundle.
*/ */
public static ChromiumLinkerParams create(Bundle bundle) { public static ChromiumLinkerParams create(Bundle bundle) {
if (!bundle.containsKey(EXTRA_LINKER_PARAMS_BASE_LOAD_ADDRESS) if (!bundle.containsKey(EXTRA_LINKER_PARAMS_BASE_LOAD_ADDRESS)) return null;
|| !bundle.containsKey(EXTRA_LINKER_PARAMS_WAIT_FOR_SHARED_RELRO)
|| !bundle.containsKey(EXTRA_LINKER_PARAMS_TEST_RUNNER_CLASS_NAME)
|| !bundle.containsKey(EXTRA_LINKER_PARAMS_LINKER_IMPLEMENTATION)) {
return null;
}
return new ChromiumLinkerParams(bundle); return new ChromiumLinkerParams(bundle);
} }
private ChromiumLinkerParams(Bundle bundle) { private ChromiumLinkerParams(Bundle bundle) {
mBaseLoadAddress = bundle.getLong(EXTRA_LINKER_PARAMS_BASE_LOAD_ADDRESS, 0); mBaseLoadAddress = bundle.getLong(EXTRA_LINKER_PARAMS_BASE_LOAD_ADDRESS, 0);
mWaitForSharedRelro = bundle.getBoolean(EXTRA_LINKER_PARAMS_WAIT_FOR_SHARED_RELRO, false);
mTestRunnerClassNameForTesting =
bundle.getString(EXTRA_LINKER_PARAMS_TEST_RUNNER_CLASS_NAME);
mLinkerImplementationForTesting =
bundle.getInt(EXTRA_LINKER_PARAMS_LINKER_IMPLEMENTATION, 0);
} }
/** /**
...@@ -94,19 +50,11 @@ public class ChromiumLinkerParams { ...@@ -94,19 +50,11 @@ public class ChromiumLinkerParams {
*/ */
public void populateBundle(Bundle bundle) { public void populateBundle(Bundle bundle) {
bundle.putLong(EXTRA_LINKER_PARAMS_BASE_LOAD_ADDRESS, mBaseLoadAddress); bundle.putLong(EXTRA_LINKER_PARAMS_BASE_LOAD_ADDRESS, mBaseLoadAddress);
bundle.putBoolean(EXTRA_LINKER_PARAMS_WAIT_FOR_SHARED_RELRO, mWaitForSharedRelro);
bundle.putString(
EXTRA_LINKER_PARAMS_TEST_RUNNER_CLASS_NAME, mTestRunnerClassNameForTesting);
bundle.putInt(EXTRA_LINKER_PARAMS_LINKER_IMPLEMENTATION, mLinkerImplementationForTesting);
} }
// For debugging traces only. // For debugging traces only.
@Override @Override
public String toString() { public String toString() {
return String.format(Locale.US, return String.format(Locale.US, "LinkerParams(baseLoadAddress:0x%x", mBaseLoadAddress);
"LinkerParams(baseLoadAddress:0x%x, waitForSharedRelro:%s, "
+ "testRunnerClassName:%s, linkerImplementation:%d",
mBaseLoadAddress, Boolean.toString(mWaitForSharedRelro),
mTestRunnerClassNameForTesting, mLinkerImplementationForTesting);
} }
} }
...@@ -108,12 +108,8 @@ public class ContentChildProcessServiceDelegate implements ChildProcessServiceDe ...@@ -108,12 +108,8 @@ public class ContentChildProcessServiceDelegate implements ChildProcessServiceDe
if (LibraryLoader.getInstance().useChromiumLinker()) { if (LibraryLoader.getInstance().useChromiumLinker()) {
assert mLinkerParams != null; assert mLinkerParams != null;
linker = getLinker(); linker = getLinker();
if (mLinkerParams.mWaitForSharedRelro) { requestedSharedRelro = true;
requestedSharedRelro = true; linker.initServiceProcess(mLinkerParams.mBaseLoadAddress);
linker.initServiceProcess(mLinkerParams.mBaseLoadAddress);
} else {
linker.disableSharedRelros();
}
} }
try { try {
LibraryLoader.getInstance().loadNowOverrideApplicationContext(hostContext); LibraryLoader.getInstance().loadNowOverrideApplicationContext(hostContext);
......
...@@ -659,9 +659,7 @@ public final class ChildProcessLauncherHelperImpl { ...@@ -659,9 +659,7 @@ public final class ChildProcessLauncherHelperImpl {
assert sLinkerInitialized; assert sLinkerInitialized;
if (sLinkerLoadAddress == 0) return null; if (sLinkerLoadAddress == 0) return null;
// Always wait for the shared RELROs in service processes. return new ChromiumLinkerParams(sLinkerLoadAddress);
final boolean waitForSharedRelros = true;
return new ChromiumLinkerParams(sLinkerLoadAddress, waitForSharedRelros);
} }
private static Bundle populateServiceBundle(Bundle bundle) { private static Bundle populateServiceBundle(Bundle bundle) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment