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

base/android: Remove mWaitForSharedRelros from Linker.java

The mWaitForSharedRelros is not used. Deeper code inspection with lizeb@
reveals that it does not cause immediate problems to ignore the state of
this member. For future improvements we should consider sending an empty
bundle with an empty LibInfo and consuming it as usual, instead of
guessing whether to expect this bundle.

Bug: 979638
Change-Id: I1c3369e7bbb818c88da4b64239c918da3c1cda1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2555120
Auto-Submit: Egor Pasko <pasko@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830552}
parent 71299a71
...@@ -138,10 +138,6 @@ public abstract class Linker { ...@@ -138,10 +138,6 @@ public abstract class Linker {
@GuardedBy("sLock") @GuardedBy("sLock")
protected LibInfo mLibInfo; protected LibInfo mLibInfo;
// Becomes true to indicate this process needs to wait for a shared RELRO in LibraryLoad().
@GuardedBy("sLock")
protected boolean mWaitForSharedRelros;
// Set to true if this runs in the browser process. Disabled by initServiceProcess(). // Set to true if this runs in the browser process. Disabled by initServiceProcess().
@GuardedBy("sLock") @GuardedBy("sLock")
protected boolean mInBrowserProcess = true; protected boolean mInBrowserProcess = true;
...@@ -258,8 +254,7 @@ public abstract class Linker { ...@@ -258,8 +254,7 @@ public abstract class Linker {
synchronized (sLock) { synchronized (sLock) {
mInBrowserProcess = false; mInBrowserProcess = false;
ensureInitializedLocked(); ensureInitializedLocked();
assert mState == State.INITIALIZED; // Not after the library has been loaded. assert mState == State.INITIALIZED;
mWaitForSharedRelros = false;
} }
} }
...@@ -298,7 +293,7 @@ public abstract class Linker { ...@@ -298,7 +293,7 @@ public abstract class Linker {
* file. The library must not be the Chromium linker library. * file. The library must not be the Chromium linker library.
* *
* @param library The library name to load. * @param library The library name to load.
* @param isFixesAddressPermitted Whether the library can be loaded at a fixed address for RELRO * @param isFixedAddressPermitted Whether the library can be loaded at a fixed address for RELRO
* sharing. * sharing.
*/ */
final void loadLibrary(String library, boolean isFixedAddressPermitted) { final void loadLibrary(String library, boolean isFixedAddressPermitted) {
...@@ -359,11 +354,8 @@ public abstract class Linker { ...@@ -359,11 +354,8 @@ public abstract class Linker {
if (DEBUG) Log.i(TAG, "initServiceProcess(0x%x) called", baseLoadAddress); if (DEBUG) Log.i(TAG, "initServiceProcess(0x%x) called", baseLoadAddress);
synchronized (sLock) { synchronized (sLock) {
mInBrowserProcess = false; mInBrowserProcess = false;
ensureInitializedLocked(); ensureInitializedLocked();
assert mState == State.INITIALIZED; assert mState == State.INITIALIZED;
mWaitForSharedRelros = true;
mBaseLoadAddress = baseLoadAddress; mBaseLoadAddress = baseLoadAddress;
} }
} }
...@@ -456,15 +448,7 @@ public abstract class Linker { ...@@ -456,15 +448,7 @@ public abstract class Linker {
// Used internally to lazily setup the common random base load address. // Used internally to lazily setup the common random base load address.
@GuardedBy("sLock") @GuardedBy("sLock")
private void setupBaseLoadAddressLocked() { private void setupBaseLoadAddressLocked() {
if (mBaseLoadAddress == -1) { if (mBaseLoadAddress == -1) mBaseLoadAddress = getRandomBaseLoadAddress();
mBaseLoadAddress = getRandomBaseLoadAddress();
if (mBaseLoadAddress == 0) {
// If the random address is 0 there are issues with finding enough
// free address space, so disable RELRO shared / fixed load addresses.
Log.w(TAG, "Disabling shared RELROs due address space pressure");
mWaitForSharedRelros = false;
}
}
} }
/** /**
......
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