[libcxx-commits] [libcxx] [libc++][Android] Disable fdsan in filebuf close.pass.cpp (PR #102412)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 16 06:51:05 PDT 2024


================
@@ -37,6 +41,13 @@ int main(int, char**)
         assert(f.close() == nullptr);
         assert(!f.is_open());
     }
+#if defined(__BIONIC__)
+    // Starting with Android API 30+, Bionic's fdsan aborts a process that
+    // attempts to close a file descriptor belonging to something else. Disable
+    // fdsan to allow closing the FD belonging to std::filebuf's FILE*.
+    if (android_fdsan_set_error_level != nullptr)
+        android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+#endif
 #if defined(__unix__)
     {
         std::filebuf f;
----------------
ldionne wrote:

Is what we're doing in this test Standards conforming? If so, is there a reason why fdsan flags it? That would seem like a false positive to me.

https://github.com/llvm/llvm-project/pull/102412


More information about the libcxx-commits mailing list