Working ASLR implementation.
ASLR for shared libraries is controlled by "-a" in ota_from_target_files.
Binary files are self-contained (supported by apriori/soslim).
Signed-off-by: Hristo Bojinov <hristo@google.com>
Change-Id: I500e325bf4a70a8d69a2ab9b2938e83dadb4e65d
diff --git a/tools/soslim/main.c b/tools/soslim/main.c
index dd8a60b..e23fbce 100644
--- a/tools/soslim/main.c
+++ b/tools/soslim/main.c
@@ -188,9 +188,13 @@
else INFO("Not building symbol filter, filter file is empty.\n");
}
#ifdef SUPPORT_ANDROID_PRELINK_TAGS
- int prelinked = 0;
+ int prelinked = 0, retouched = 0;
int elf_little; /* valid if prelinked != 0 */
long prelink_addr; /* valid if prelinked != 0 */
+#define RETOUCH_MAX_SIZE 500000
+ /* _cnt valid if retouched != 0 */
+ unsigned int retouch_byte_cnt = RETOUCH_MAX_SIZE;
+ char retouch_buf[RETOUCH_MAX_SIZE]; /* valid if retouched != 0 */
#endif
clone_elf(elf, newelf,
infile, outfile,
@@ -200,7 +204,10 @@
#ifdef SUPPORT_ANDROID_PRELINK_TAGS
, &prelinked,
&elf_little,
- &prelink_addr
+ &prelink_addr,
+ &retouched,
+ &retouch_byte_cnt,
+ retouch_buf
#endif
,
true, /* rebuild the section-header-strings table */
@@ -223,6 +230,13 @@
infile, strerror(errno), errno);
#ifdef SUPPORT_ANDROID_PRELINK_TAGS
+ if (retouched) {
+ INFO("File has retouch data, putting it back in place.\n");
+ retouch_dump(outfile != NULL ? outfile : infile,
+ elf_little,
+ retouch_byte_cnt,
+ retouch_buf);
+ }
if (prelinked) {
INFO("File is prelinked, putting prelink TAG back in place.\n");
setup_prelink_info(outfile != NULL ? outfile : infile,