docs: Refer to crazylinker as history.
The crazylinker was removed in crrev.com/1075793, updating the
documentation. It carries some fly-by adjustments in documentation.
Also remove a stale entry from WATCHLISTS.
Bug: 1383210
Change-Id: I529c06e47ebf90ba424860f7005ef9dc3b0ced1d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4061632
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Reviewed-by: Eric Foo <efoo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1078026}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
a02a5eaa9f
commit
438cf4e22c
@ -59,9 +59,6 @@
|
||||
'|components/crash/android/' \
|
||||
'|components/minidump_uploader/'
|
||||
},
|
||||
'android_crazy_linker': {
|
||||
'filepath': 'third_party/android_crazy_linker/'
|
||||
},
|
||||
'android_flags': {
|
||||
'filepath': 'chrome/android/java/src/org/chromium/chrome/browser/flags/'
|
||||
},
|
||||
@ -2257,7 +2254,6 @@
|
||||
'chikamune+watch@chromium.org'],
|
||||
'android_crash_reporting': ['asvitkine+watch@chromium.org',
|
||||
'wnwen+watch@chromium.org'],
|
||||
'android_crazy_linker': ['johnmaguire+watch@google.com'],
|
||||
'android_flags': ['hnakashima+watch@chromium.org'],
|
||||
'android_infobars': ['dfalcantara+watch@chromium.org'],
|
||||
'android_infra': ['agrieve+watch@chromium.org',
|
||||
|
@ -1,8 +1,5 @@
|
||||
# //base/android/library_loader
|
||||
|
||||
Native code is split between this directory and:
|
||||
* [//third_party/android_crazy_linker](../../../third_party/android_crazy_linker/README.chromium)
|
||||
|
||||
Java code lives at:
|
||||
* [//base/android/java/src/org/chromium/base/library_loader/](../java/src/org/chromium/base/library_loader/)
|
||||
|
||||
|
@ -15,9 +15,6 @@ shared_library("chromium_android_linker") {
|
||||
"linker_minimal_libcxx.cc",
|
||||
]
|
||||
|
||||
# The NDK contains the crazy_linker here:
|
||||
# '<(android_ndk_root)/crazy_linker.gyp:crazy_linker'
|
||||
# However, we use our own fork. See bug 384700.
|
||||
deps = [ "//build:buildflag_header_h" ]
|
||||
|
||||
# Export JNI symbols.
|
||||
|
@ -184,14 +184,11 @@ depending on the version of Android running on a device. Chrome uses this
|
||||
feature to package optimized versions for different OS versions.
|
||||
|
||||
1. `chrome_modern_public_bundle` (ChromeModernPublic.aab)
|
||||
* `minSdkVersion=21` (Lollipop).
|
||||
* Uses [Crazy Linker](https://cs.chromium.org/chromium/src/base/android/linker/BUILD.gn?rcl=6bb29391a86f2be58c626170156cbfaa2cbc5c91&l=9).
|
||||
* Stores native library with "crazy." prefix to prevent extraction.
|
||||
* `minSdkVersion=25` (Nougat).
|
||||
* WebView packaged independently (`system_webview_bundle`).
|
||||
2. `monochrome_public_bundle` (MonochromePublic.aab)
|
||||
* `minSdkVersion=24` (Nougat).
|
||||
* `minSdkVersion=25` (Nougat).
|
||||
* Contains both Chrome and WebView (to save disk space).
|
||||
* Does not use Crazy Linker (WebView requires system linker).
|
||||
3. `trichrome_chrome_bundle` (TrichromeChrome.aab)
|
||||
* `minSdkVersion=29` (Android 10).
|
||||
* Native code shared with WebView through a "Static Shared Library APK": `trichrome_library_apk`
|
||||
|
@ -5,12 +5,6 @@ Chrome on Android.
|
||||
[TOC]
|
||||
|
||||
## Library Packaging
|
||||
* Android L & M (ChromeModernPublic.aab):
|
||||
* `libchrome.so` is stored uncompressed within the apk (with the name
|
||||
`crazy.libchrome.so` to avoid extraction).
|
||||
* It is loaded directly from the apk via `libchromium_android_linker.so`.
|
||||
* Only JNI_OnLoad is exported, since manual JNI registration is required
|
||||
(see [//base/android/jni_generator/README.md]).
|
||||
* Android N, O & P (MonochromePublic.aab):
|
||||
* `libmonochrome.so` is stored uncompressed within the apk (an
|
||||
AndroidManifest.xml attribute disables extraction).
|
||||
@ -26,8 +20,6 @@ Chrome on Android.
|
||||
* It is loaded by `libchromium_android_linker.so` using
|
||||
`android_dlopen_ext()` to enable RELRO sharing.
|
||||
|
||||
[//base/android/jni_generator/README.md]: /base/android/jni_generator/README.md
|
||||
|
||||
## Build Variants (eg. monochrome_64_32_apk)
|
||||
The packaging above extends to cover both 32-bit and 64-bit device
|
||||
configurations.
|
||||
@ -147,7 +139,6 @@ Builds on | Variant | Chrome | Library | Webview
|
||||
* For ChromePublic.apk:
|
||||
* `JNI_OnLoad()` is the only exported symbol (enforced by a linker script).
|
||||
* Native methods registered explicitly during start-up by generated code.
|
||||
* Explicit generation is required because the Android runtime uses the system's `dlsym()`, which doesn't know about Crazy-Linker-opened libraries.
|
||||
* For MonochromePublic.apk and TrichromeChrome.aab:
|
||||
* `JNI_OnLoad()` and `Java_*` symbols are exported by linker script.
|
||||
* No manual JNI registration is done. Symbols are resolved lazily by the runtime.
|
||||
@ -172,16 +163,6 @@ Builds on | Variant | Chrome | Library | Webview
|
||||
* Processes `fork()`ed from the app zygote (where the library is loaded) share RELRO (via `fork()`'s copy-on-write semantics), but this region is not shared with other process types (privileged, utility, GPU)
|
||||
|
||||
**How does it work?**
|
||||
* For Android < N (crazy linker):
|
||||
1. Browser Process: `libchrome.so` loaded normally.
|
||||
2. Browser Process: `GNU_RELRO` segment copied into `ashmem` (shared memory).
|
||||
3. Browser Process (low-end only): RELRO private memory pages swapped out for ashmem ones (using `munmap()` & `mmap()`).
|
||||
4. Browser Process: Load address and shared memory fd passed to renderers / gpu process.
|
||||
5. Renderer Process: Crazy linker tries to load to the given load address.
|
||||
* Loading can fail due to address space randomization causing something else to already by loaded at the address.
|
||||
6. Renderer Process: If loading to the desired address succeeds:
|
||||
* Linker puts `GNU_RELRO` into private memory and applies relocations as per normal.
|
||||
* Afterwards, memory pages are compared against the shared memory and all identical pages are swapped out for ashmem ones (using `munmap()` & `mmap()`).
|
||||
* For a more detailed description, refer to comments in [Linker.java](https://cs.chromium.org/chromium/src/base/android/java/src/org/chromium/base/library_loader/Linker.java).
|
||||
* For Android N-P:
|
||||
* The OS maintains a RELRO file on disk with the contents of the GNU_RELRO segment.
|
||||
@ -204,6 +185,13 @@ Builds on | Variant | Chrome | Library | Webview
|
||||
app zygote. `libmonochrome.so` is loaded in the zygote before `fork()`.
|
||||
* Similar to O-P, app zygote provides copy-on-write memory semantics so
|
||||
RELRO sharing is redundant.
|
||||
* For Android R+ (still Trichrome)
|
||||
* The RELRO region is created in the App Zygote, picked up by the Browser
|
||||
process, which then redistributes the region to all other processes. The
|
||||
receiving of the region and remapping it on top of the non-shared RELRO
|
||||
happens asynchronously after the library has been loaded. Native code is
|
||||
generally already running at this point. Hence the replacement must be
|
||||
atomic.
|
||||
|
||||
## Partitioned libraries
|
||||
Some Chrome code is placed in feature-specific libraries and delivered via
|
||||
@ -267,6 +255,13 @@ Partitioned libraries are usable when all of the following are true:
|
||||
* This was removed due to [poor performance](https://bugs.chromium.org/p/chromium/issues/detail?id=719977).
|
||||
* We used to use `relocation_packer` to pack relocations after linking, which complicated our build system and caused many problems for our tools because it caused logical addresses to differ from physical addresses.
|
||||
* We now link with `lld`, which supports packed relocations natively and doesn't have these problems.
|
||||
* We used to use the Crazy Linker until Android M was deprecated
|
||||
* It allowed storing `libchrome.so` uncompressed within the apk before the
|
||||
system linker allowed it (with the name `crazy.libchrome.so` to avoid extraction).
|
||||
* It was loaded directly from the apk via `libchromium_android_linker.so`.
|
||||
* Only JNI_OnLoad was exported. Explicit JNI registration was required
|
||||
because the Android runtime uses the system's `dlsym()`, which doesn't know
|
||||
about Crazy-Linker-opened libraries. (see [//base/android/jni_generator/README.md]).
|
||||
|
||||
## See Also
|
||||
* [//docs/android_build_instructions.md#Multiple-Chrome-APK-Targets](android_build_instructions.md#Multiple-Chrome-APK-Targets)
|
||||
|
@ -261,8 +261,6 @@ third_party/afl/src 3 1
|
||||
third_party/afl/src/docs 11 2
|
||||
third_party/afl/src/llvm_mode 1 1
|
||||
third_party/afl/src/qemu_mode 1 1
|
||||
third_party/android_crazy_linker 1 1
|
||||
third_party/android_crazy_linker/src/src 1 1
|
||||
third_party/android_deps 1 1
|
||||
third_party/android_deps_autorolled 1 1
|
||||
third_party/android_deps/buildSrc/src/main/groovy 25 2
|
||||
|
Reference in New Issue
Block a user