Investigate rel.ro sharing on Android
Categories
(GeckoView :: General, enhancement, P2)
Tracking
(Not tracked)
People
(Reporter: jrmuizel, Unassigned)
References
(Blocks 1 open bug)
Details
Reporter | ||
Updated•4 months ago
|
Reporter | ||
Updated•4 months ago
|
Comment 1•4 months ago
|
||
For a Firefox Nightly aarch64 build, readelf --segments libxul.so
prints
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
[...]
GNU_RELRO 0x932e640 0x0000000009336640 0x0000000009336640 0x59a828 0x59a9c0 R 0x1
and this segment encompasses the following sections:
[19] .data.rel.ro PROGBITS 0000000009336640 932e640 577348 00 WA 0 0 16
[20] .fini_array FINI_ARRAY 00000000098ad988 98a5988 000010 00 WA 0 0 8
[21] .init_array INIT_ARRAY 00000000098ad998 98a5998 0002b0 00 WA 0 0 8
[22] .dynamic DYNAMIC 00000000098adc48 98a5c48 000250 10 WA 9 0 8
[23] .got PROGBITS 00000000098ade98 98a5e98 00cb10 00 WA 0 0 8
[24] .got.plt PROGBITS 00000000098ba9a8 98b29a8 0164c0 00 WA 0 0 8
[25] .relro_padding NOBITS 00000000098d0e68 98c8e68 000198 00 WA 0 0 1
0x59a9c0 is 5876160, so the relro segment is responsible for 5.9MB of extra memory usage per Firefox process.
Comment 2•4 months ago
|
||
I thought that we fork()-without-exec'd on Android for stuff like content processes, so doesn't that give us that sharing for free?
Reporter | ||
Comment 3•4 months ago
|
||
It would, but we don't have that on Android. That requires the use of Zygote infrastructure that we have in bug 1859857.
Comment 4•4 months ago
|
||
Do we understand how this optimization interacts with the App Zygote?
Specifically, does the App Zygote get us relro sharing effectively for free, or is relro sharing beneficial even if we have the App Zygote?
The source code for Chrome's relro sharing is here:
https://source.chromium.org/chromium/chromium/src/+/main:base/android/java/src/org/chromium/base/library_loader/Linker.java;l=31
https://source.chromium.org/chromium/chromium/src/+/main:base/android/linker/linker_jni.h;l=244
I've also found this page:
This makes me think that they're using relro sharing in order to save memory if the WebView is used by multiple different apps.
So my current thinking is that relro sharing is not needed for the purposes of saving memory in renderer processes of the same app, if you have an app zygote.
Updated•4 months ago
|
Updated•3 months ago
|
Description
•