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

Ryan Prichard via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 11 13:41:24 PST 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;
----------------
rprichard wrote:

Ok, I'm now skipping that part of the test using `#if defined(__unix__) && !defined(__BIONIC__)`.

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


More information about the libcxx-commits mailing list