summaryrefslogtreecommitdiffstats
path: root/linker/linker.cpp
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2013-06-21 12:31:33 -0700
committerNick Kralevich <nnk@google.com>2013-06-21 15:33:15 -0700
commitc9084427aa15259c8bfb9b13b979597a4abd1805 (patch)
tree3034d0cab47807e06a4d0ff17d3ad4b555753cb5 /linker/linker.cpp
parent6819773103495a6fd81f024dc6711771320ae4ec (diff)
downloadbionic-c9084427aa15259c8bfb9b13b979597a4abd1805.zip
bionic-c9084427aa15259c8bfb9b13b979597a4abd1805.tar.gz
bionic-c9084427aa15259c8bfb9b13b979597a4abd1805.tar.bz2
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
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r--linker/linker.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index c53d52f..9c35cfc 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -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));