bitcoin/contrib/valgrind.supp
Ava Chow 22770ce8cb
Merge bitcoin/bitcoin#31282: refactor: Make node_id a const& in RemoveBlockRequest
fa21f83d29 ci: Use G++ in valgrind tasks (MarcoFalke)
fabd05bf65 refactor: Fix net_processing iwyu includes (MarcoFalke)
fa1622db20 refactor: Make node_id a const& in RemoveBlockRequest (MarcoFalke)

Pull request description:

  Currently, `valgrind` is not usable on a default build with GCC. Specifically, `p2p_compactblocks.py --valgrind` gives a false-positive in `RemoveBlockRequest` when comparing `node_id` with `from_peer`. According to the upstream bug report, this happens because both symbols are on the stack and the compiler can more aggressively optimize the compare (order). See https://bugs.kde.org/show_bug.cgi?id=472329#c7

  It is possible to work around this bug by pulling at least one value from the stack. For example, by making `from_peer` a `const` reference. Alternatively, by replacing `auto [node_id, list_it]` with `const auto& [node_id, list_it]`, which is done here.

  I think this workaround is acceptable, because it does not look like valgrind can trivially fix this. The alternative would be to add a (temporary?) suppression.

  Fixes https://github.com/bitcoin/bitcoin/issues/27741

  Also, fix iwyu includes, while touching this module.

  Also, switch the CI valgrind scripts to use G++.

ACKs for top commit:
  achow101:
    ACK fa21f83d29
  TheCharlatan:
    ACK fa21f83d29
  darosior:
    utACK fa21f83d29
  ryanofsky:
    Code review ACK fa21f83d29. Code changes all look good but I'm a little confused about purpose of the third commit, so left a question about that

Tree-SHA512: 7b92cdafd525a5ac53ae2c1a7a92e599bc9b5fd5d315a694b493cd5079ac323d884393b57aa18581b7789247a588c9a27d47698de25b340bc76fc9f1dd1850b4
2025-04-14 14:22:56 -07:00

96 lines
2.2 KiB
Text

# This valgrind suppressions file includes known Valgrind warnings in our
# dependencies that cannot be fixed in-tree.
#
# Example use:
# $ valgrind --suppressions=contrib/valgrind.supp build/bin/test_bitcoin
# $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \
# --show-leak-kinds=all build/bin/test_bitcoin
#
# To create suppressions for found issues, use the --gen-suppressions=all option:
# $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \
# --show-leak-kinds=all --gen-suppressions=all --show-reachable=yes \
# --error-limit=no build/bin/test_bitcoin
#
# Note that suppressions may depend on OS and/or library versions.
# Tested on aarch64 and x86_64 with Ubuntu Noble system libs, using clang-16
# and GCC, without gui.
{
Suppress libdb warning - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662917
Memcheck:Cond
obj:*/libdb_cxx-*.so
fun:__log_put
}
{
Suppress libdb warning
Memcheck:Param
pwrite64(buf)
fun:pwrite
fun:__os_io
}
{
Suppress libdb warning
Memcheck:Cond
fun:__log_putr.isra.1
}
{
Suppress libdb warning
Memcheck:Param
pwrite64(buf)
...
obj:*/libdb_cxx-*.so
}
{
Suppress uninitialized bytes warning in compat code
Memcheck:Param
ioctl(TCSET{S,SW,SF})
fun:tcsetattr
}
{
Suppress libdb warning
Memcheck:Leak
fun:malloc
...
obj:*/libdb_cxx-*.so
}
{
Suppress leaks on shutdown
Memcheck:Leak
...
fun:_Z8ShutdownR11NodeContext
}
{
Suppress leveldb leak
Memcheck:Leak
match-leak-kinds: reachable
fun:_Znwm
...
fun:_ZN7leveldb6DBImpl14BackgroundCallEv
}
{
Suppress leveldb leak
Memcheck:Leak
fun:_Znwm
...
fun:GetCoin
}
{
Suppress LogInstance still reachable memory warning
Memcheck:Leak
match-leak-kinds: reachable
fun:_Znwm
fun:_Z11LogInstancev
}
{
Suppress BCLog::Logger::StartLogging() still reachable memory warning
Memcheck:Leak
match-leak-kinds: reachable
fun:malloc
...
fun:_ZN5BCLog6Logger12StartLoggingEv
}
{
Suppress https://bugs.kde.org/show_bug.cgi?id=472219 - fixed in Valgrind 3.22.
Memcheck:Param
ppoll(ufds.events)
obj:/lib/ld-musl-aarch64.so.1
}