OSDN Git Service

bionic: add machine type check
authorZhenghua Wang <zhenghua.wang@intel.com>
Tue, 18 Oct 2011 16:29:14 +0000 (00:29 +0800)
committerJean-Baptiste Queru <jbq@google.com>
Wed, 30 Nov 2011 01:01:08 +0000 (17:01 -0800)
android linker doesn't check machine type, it may load some
libraries which it doesn't support sometimes.

Author: Zhenghua Wang <zhenghua.wang@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
linker/linker.c

index e0a8a18..17008f8 100644 (file)
@@ -707,7 +707,11 @@ verify_elf_object(void *base, const char *name)
     if (hdr->e_ident[EI_MAG3] != ELFMAG3) return -1;
 
     /* TODO: Should we verify anything else in the header? */
-
+#ifdef ANDROID_ARM_LINKER
+    if (hdr->e_machine != EM_ARM) return -1;
+#elif defined(ANDROID_X86_LINKER)
+    if (hdr->e_machine != EM_386) return -1;
+#endif
     return 0;
 }