linker: Emit a warning on text relocations
Text relocations unnecessarily mark pages as dirty, preventing them from being swapped out, wasting memory. Also, text relocations prevent the code from running on certain hardened systems. Print a message in logcat and stderr when we see a text relocation, to encourage developers to fix their code. Change-Id: I6051a7463911e090ae5727a355397d539669d5b9
This commit is contained in:
parent
6819773103
commit
c9084427aa
1 changed files with 2 additions and 0 deletions
|
@ -1533,6 +1533,8 @@ static bool soinfo_link_image(soinfo* si) {
|
|||
* phdr_table_protect_segments() after all of them are applied
|
||||
* and all constructors are run.
|
||||
*/
|
||||
DL_WARN("%s has text relocations. This is wasting memory and is "
|
||||
"a security risk. Please fix.", si->name);
|
||||
if (phdr_table_unprotect_segments(si->phdr, si->phnum, si->load_bias) < 0) {
|
||||
DL_ERR("can't unprotect loadable segments for \"%s\": %s",
|
||||
si->name, strerror(errno));
|
||||
|
|
Loading…
Reference in a new issue