-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android library loading messes up DR handling #1860
Comments
Because of #1760 where we check for a new lib on new exec in a new vm_area. |
C) Delay adding the module until 1st exec, when i#1760 kicks in. |
D) Modify the loader's initial mmap to be file-backed instead of anon? It Interactions with pcaches are probably the primary concern. |
0b58677 implemented solution B |
There was special handling for old Android behaviour where Android did not map the whole file at once. This behaviour is not present in more recent versions of Android, and the associated handling causes 'CURIOSITY'-ies on debug builds, which it was originally introduced to prevent: #1860 These CURIOSITIES were caused by the delayed call to os_module_update_dynamic_info() that only happened for Android. Issues: #2154, #1860, #7125
On Android on any app we see:
It's libc:
First it seems to map the 1st page to read the headers I guess,
coincidentally sits where the linker anon is later put:
Then it does the final map:
And removes the 1-page header:
So it thinks the main mmap is partial.
More info:
It's b/c its whole-image mmap is anon, and so the first file-backed one
with an ELF header is just the code segment.
On Linux the loader's 1st +rx mmap with file backing covers the entire file:
All the UNIX DR code for handling libraries assumes the Linux model.
We have another problem: a fault trying to read the dynamic section.
module_fill_os_data() assumes the whole file is mapped in, but it's not, so
the dynamic section is off the end:
1st segment size is 0x65960.
So do we:
A) Mmap the whole file ourselves?
B) Delay this data init until the segment containing .dynamic is loaded.
The client lib load event is delayed anyway. Will this mess up some
internal part of DR?
Plus, how are any app modules being added? Wasn't drcov working?
The text was updated successfully, but these errors were encountered: