Skip to content

fuzz: AddressSanitizer: odr-violation typeinfo name for CCoinsViewBacked #32995

@fanquake

Description

@fanquake
# clang++ --version
clang version 20.1.8 (Fedora 20.1.8-1.fc43)
Target: aarch64-redhat-linux-gnu

make -C depends/ NO_QT=1 NO_ZMQ=1 NO_USDT=1 NO_WALLET=1 NO_IPC=1 AR=llvm-ar NM=llvm-nm RANLIB=llvm-ranlib STRIP=llvm-strip LDFLAGS="-fuse-ld=lld" CC=clang CXX=clang++
cmake -B build --toolchain /root/bitcoin/depends/aarch64-unknown-linux-gnu/toolchain.cmake -DBUILD_FOR_FUZZING=ON -DSANITIZERS=address -DAPPEND_CFLAGS="-flto=full" -DAPPEND_CXXFLAGS="-flto=full" -DAPPEND_LDFLAGS="-flto=full"
cmake --build build
./build/bin/fuzz
=================================================================
==987273==ERROR: AddressSanitizer: odr-violation (0xab71fdf737c0):
  [1] size=19 'typeinfo name for CCoinsViewBacked' /root/bitcoin/src/coins.cpp in /root/bitcoin/build/bin/fuzz
  [2] size=19 'typeinfo name for CCoinsViewBacked' /root/bitcoin/src/coins.cpp in /root/bitcoin/build/bin/fuzz
These globals were registered at these points:
  [1]:
    #0 0xab71fcd09e3c in __asan_register_globals (/root/bitcoin/build/bin/fuzz+0x2d9e3c) (BuildId: f2dc106e95ba2dafe63dc7170e17e7f0baf3ce0a)
    #1 0xab71fcd0aef4 in __asan_register_elf_globals (/root/bitcoin/build/bin/fuzz+0x2daef4) (BuildId: f2dc106e95ba2dafe63dc7170e17e7f0baf3ce0a)
    #2 0xab71fccf64ac in _start (/root/bitcoin/build/bin/fuzz+0x2c64ac) (BuildId: f2dc106e95ba2dafe63dc7170e17e7f0baf3ce0a)

  [2]:
    #0 0xab71fcd09e3c in __asan_register_globals (/root/bitcoin/build/bin/fuzz+0x2d9e3c) (BuildId: f2dc106e95ba2dafe63dc7170e17e7f0baf3ce0a)
    #1 0xab71fcd0aef4 in __asan_register_elf_globals (/root/bitcoin/build/bin/fuzz+0x2daef4) (BuildId: f2dc106e95ba2dafe63dc7170e17e7f0baf3ce0a)
    #2 0xab71fccf64ac in _start (/root/bitcoin/build/bin/fuzz+0x2c64ac) (BuildId: f2dc106e95ba2dafe63dc7170e17e7f0baf3ce0a)

==987273==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY: AddressSanitizer: odr-violation: global 'typeinfo name for CCoinsViewBacked' at /root/bitcoin/src/coins.cpp in /root/bitcoin/build/bin/fuzz
==987273==ABORTING

Noticed while retrying -flto with oss-fuzz. Saw something similar there, under -O1:

[100%] Built target fuzz
+ WRITE_ALL_FUZZ_TARGETS_AND_ABORT=/tmp/a
+ ./build_fuzz/bin/fuzz
=================================================================
==8668==ERROR: AddressSanitizer: odr-violation (0x55c825a8e0a0):
  [1] size=20 'typeinfo name for leveldb::Snapshot' /src/bitcoin-core/src/leveldb/db/db_impl.cc in /src/bitcoin-core/build_fuzz/bin/fuzz
  [2] size=20 'typeinfo name for leveldb::Snapshot' /src/bitcoin-core/src/leveldb/db/db_impl.cc in /src/bitcoin-core/build_fuzz/bin/fuzz
These globals were registered at these points:
  [1]:
    #0 0x55c82338e5a6 in __asan_register_globals /src/llvm-project/compiler-rt/lib/asan/asan_globals.cpp:369:3
    #1 0x55c82338f6c9 in __asan_register_elf_globals /src/llvm-project/compiler-rt/lib/asan/asan_globals.cpp:352:3
    #2 0x55c8255c24ec in __libc_csu_init (/src/bitcoin-core/build_fuzz/bin/fuzz+0x32724ec)

  [2]:
    #0 0x55c82338e5a6 in __asan_register_globals /src/llvm-project/compiler-rt/lib/asan/asan_globals.cpp:369:3
    #1 0x55c82338f6c9 in __asan_register_elf_globals /src/llvm-project/compiler-rt/lib/asan/asan_globals.cpp:352:3
    #2 0x55c8255c24ec in __libc_csu_init (/src/bitcoin-core/build_fuzz/bin/fuzz+0x32724ec)

==8668==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY: AddressSanitizer: odr-violation: global 'typeinfo name for leveldb::Snapshot' at /src/bitcoin-core/src/leveldb/db/db_impl.cc in /src/bitcoin-core/build_fuzz/bin/fuzz
==8668==ABORTING

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions