[libcxx-commits] [libcxx] [libc++] Simplify the implementation of iostream.cpp (PR #124103)
Vitaly Buka via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 12 10:59:22 PST 2025
vitalybuka wrote:
Looks like false init order fiasco, which are known https://github.com/google/sanitizers/wiki/AddressSanitizerInitializationOrderFiasco#false-positives
However at this is libc++, it's going to bite all users.
Downstream we can suppress with ignore list, but it would be nice do to something like:
```
# define STREAM(StreamT, BufferT, CharT, var) stream_data<StreamT<CharT>, BufferT<CharT>> var __attribute__((no_sanitize("address")))
```
```
Details
=================================================================
==2956==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x7f63c11a6940 at pc 0x7f63c0d00300 bp 0x7fff16233810 sp 0x7fff16233808
READ of size 8 at 0x7f63c11a6940 thread T0
#0 in std::__u::basic_ostream<char, std::__u::char_traits<char>>::sentry::sentry(std::__u::basic_ostream<char, std::__u::char_traits<char>>&) libcxx/include/__ostream/basic_ostream.h:198:7
#1 in std::__u::basic_ostream<char, std::__u::char_traits<char>>::write(char const*, long) libcxx/include/__ostream/basic_ostream.h:478:12
#2 in AbslFormatFlush absl/strings/internal/str_format/output.h:75:8
#3 in InvokeFlush<std::__u::basic_ostream<char, std::__u::char_traits<char> > > absl/strings/internal/str_format/output.h:90:3
...
#2 in call_init
#2 in _dl_init
#2 in _dl_start_user
0x7f63c11a6940 is located 0 bytes inside of global variable 'std::__u::cerr' defined in 'libcxx/src/iostream.cpp' (0x7f63c11a6940) of size 264
registered at:
#0 in __asan_register_globals llvm-project/compiler-rt/lib/asan/asan_globals.cpp:431:3
#1 in __asan_register_elf_globals llvm-project/compiler-rt/lib/asan/asan_globals.cpp:414:3
#2 in asan.module_ctor algorithm.cpp
#3 in call_init
#4 in _dl_init
#5 in _dl_start_user
```
@philnik777 WDYT?
https://github.com/llvm/llvm-project/pull/124103
More information about the libcxx-commits
mailing list