[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
Thu Nov 28 13:04:10 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;
----------------
ldionne wrote:
Yes, I'd much rather simply skip this test on Bionic. Re-reading the test, it is indeed doing something wrong but it's guarding with `#if defined(__unix__)`, which basically means "I know I'm doing something wrong, but defined(__unix__) lets me get away with it". Instead, we want to change that to "I know I'm doing something wrong, but defined(__unix__) && !defined(__BIONIC__) lets me get away with it", since Bionic doesn't let you get away with it.
https://github.com/llvm/llvm-project/pull/102412
More information about the libcxx-commits
mailing list