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

via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 7 12:27:22 PDT 2025


Author: Ryan Prichard
Date: 2025-05-07T15:27:19-04:00
New Revision: 93aba1e240dbf8fa8f71cbc05dcae2dc1498c2dd

URL: https://github.com/llvm/llvm-project/commit/93aba1e240dbf8fa8f71cbc05dcae2dc1498c2dd
DIFF: https://github.com/llvm/llvm-project/commit/93aba1e240dbf8fa8f71cbc05dcae2dc1498c2dd.diff

LOG: [libc++][Android] Disable fdsan in filebuf close.pass.cpp (#102412)

fdsan is Bionic's "File Descriptor Sanitizer". Starting in API 30+, it
aborts this close.pass.cpp test, because it closes the FD belonging to
std::filebuf's FILE*. For `__BIONIC__`, disable that part of the test.

Added: 
    

Modified: 
    libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/close.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/close.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/close.pass.cpp
index e0338e6f619b7..43233decf1b34 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/close.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/close.pass.cpp
@@ -10,11 +10,6 @@
 
 // basic_filebuf<charT,traits>* close();
 
-// This test closes an fd that belongs to a std::filebuf, and Bionic's fdsan
-// detects this and aborts the process, starting in Android R (API 30).
-// See D137129.
-// XFAIL: LIBCXX-ANDROID-FIXME && !android-device-api={{2[1-9]}}
-
 #include <fstream>
 #include <cassert>
 #if defined(__unix__)
@@ -37,7 +32,10 @@ int main(int, char**)
         assert(f.close() == nullptr);
         assert(!f.is_open());
     }
-#if defined(__unix__)
+    // Starting with Android API 30+, Bionic's fdsan aborts a process that calls
+    // close() on a file descriptor tagged as belonging to something else (such
+    // as a FILE*).
+#if defined(__unix__) && !defined(__BIONIC__)
     {
         std::filebuf f;
         assert(!f.is_open());


        


More information about the libcxx-commits mailing list