The workaround for apps using older version of soinfos

Skip the check for accessibility in the case soinfo
does not have primary/secondary namespaces associated
with them.

Bug: http://b/37191433
Test: start an app from http://b/37191433 make sure it does not crash on lunch
Change-Id: Id4c0bdab4dfc6bc8a33fc275d71e325518e0759f
(cherry picked from commit 97b4c5f2649db06661e45147f21a2ab26340ad89)
diff --git a/linker/linker_namespaces.cpp b/linker/linker_namespaces.cpp
index 273ff9b..3c86f99 100644
--- a/linker/linker_namespaces.cpp
+++ b/linker/linker_namespaces.cpp
@@ -27,6 +27,7 @@
  */
 
 #include "linker_namespaces.h"
+#include "linker_globals.h"
 #include "linker_soinfo.h"
 #include "linker_utils.h"
 
@@ -58,6 +59,13 @@
 
 bool android_namespace_t::is_accessible(soinfo* s) {
   auto is_accessible_ftor = [this] (soinfo* si) {
+    // This is workaround for apps hacking into soinfo list.
+    // and inserting their own entries into it. (http://b/37191433)
+    if (!si->has_min_version(3)) {
+      DL_WARN("invalid soinfo version for \"%s\"", si->get_soname());
+      return false;
+    }
+
     if (si->get_primary_namespace() == this) {
       return true;
     }