Merge "Document the intricacies of `_FILE_OFFSET_BITS=32` for LP32."
am: a571e9e748

Change-Id: I6f646e36ae2de0a50dac703fcac385fb116035e3
diff --git a/libc/bionic/system_properties.cpp b/libc/bionic/system_properties.cpp
index a958699..6906ecd 100644
--- a/libc/bionic/system_properties.cpp
+++ b/libc/bionic/system_properties.cpp
@@ -1051,16 +1051,15 @@
     if (!initialize_properties_from_file("/system/etc/selinux/plat_property_contexts")) {
       return false;
     }
-    if (!initialize_properties_from_file("/vendor/etc/selinux/nonplat_property_contexts")) {
-      return false;
-    }
+    // Don't check for failure here, so we always have a sane list of properties.
+    // E.g. In case of recovery, the vendor partition will not have mounted and we
+    // still need the system / platform properties to function.
+    initialize_properties_from_file("/vendor/etc/selinux/nonplat_property_contexts");
   } else {
     if (!initialize_properties_from_file("/plat_property_contexts")) {
       return false;
     }
-    if (!initialize_properties_from_file("/nonplat_property_contexts")) {
-      return false;
-    }
+    initialize_properties_from_file("/nonplat_property_contexts");
   }
 
   return true;
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index 0a9aeab..2bdde1e 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -371,6 +371,15 @@
                                       bool is_asan,
                                       const Config** config,
                                       std::string* error_msg) {
+  // TODO(b/38114603) Currently, multiple namespaces does not support ASAN mode
+  // where some symbols should be intercepted via LD_PRELOAD; LD_PRELOADed libs
+  // are not being preloaded into the linked namespaces other than the default
+  // namespace. Until we fix the problem, we temporarily disable ld.config.txt
+  // in ASAN mode.
+  if (is_asan) {
+    return false;
+  }
+
   g_config.clear();
 
   std::unordered_map<std::string, PropertyValue> property_map;
diff --git a/linker/tests/linker_config_test.cpp b/linker/tests/linker_config_test.cpp
index c6fade9..87609d0 100644
--- a/linker/tests/linker_config_test.cpp
+++ b/linker/tests/linker_config_test.cpp
@@ -168,6 +168,7 @@
   run_linker_config_smoke_test(false);
 }
 
-TEST(linker_config, asan_smoke) {
-  run_linker_config_smoke_test(true);
-}
+// TODO(b/38114603) revive this test when ld.config.txt is enabled for ASAN mode
+//TEST(linker_config, asan_smoke) {
+//  run_linker_config_smoke_test(true);
+//}
diff --git a/tests/fcntl_test.cpp b/tests/fcntl_test.cpp
index 1bef0f4..f385311 100644
--- a/tests/fcntl_test.cpp
+++ b/tests/fcntl_test.cpp
@@ -20,12 +20,14 @@
 #include <fcntl.h>
 #include <string.h>
 #include <sys/utsname.h>
+#include <sys/vfs.h>
 
 #include "TemporaryFile.h"
 
 // Glibc v2.19 doesn't include these in fcntl.h so host builds will fail without.
 #if !defined(FALLOC_FL_PUNCH_HOLE) || !defined(FALLOC_FL_KEEP_SIZE)
 #include <linux/falloc.h>
+#include <linux/magic.h>
 #endif
 
 TEST(fcntl, fcntl_smoke) {
@@ -288,7 +290,11 @@
 
   if (major < 4 || (major == 4 && minor < 1)) {
     TemporaryFile tf;
-    ASSERT_EQ(-1, fallocate(tf.fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1));
-    ASSERT_EQ(errno, EOPNOTSUPP);
+    struct statfs sfs;
+    ASSERT_EQ(0, fstatfs(tf.fd, &sfs));
+    if (sfs.f_type == EXT4_SUPER_MAGIC) {
+      ASSERT_EQ(-1, fallocate(tf.fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1));
+      ASSERT_EQ(errno, EOPNOTSUPP);
+    }
   }
 }