test: use-of-uninitialized-value in sqlite3Strlen30 #27222

issue maflcko openend this issue on March 7, 2023
  1. maflcko commented at 4:33 pm on March 7, 2023: member

    https://cirrus-ci.com/task/5021971277152256?logs=ci#L3656

     0wallet/test/feebumper_tests.cpp(18): Entering test suite "feebumper_tests"
     1wallet/test/feebumper_tests.cpp(42): Entering test case "external_max_weight_test"
     22023-01-30T17:19:34Z Seed: Setting random seed for current tests to RANDOM_CTX_SEED=231d587d0169ecab6befbed75f49c95aa84567b2750479dca13bd7471f2627e2
     32023-01-30T17:19:34.255341Z [test] [init/common.cpp:149] [LogPackageVersion] Bitcoin Core version v24.99.0-a55717c914f8 (release build)
     42023-01-30T17:19:34.256134Z [test] [kernel/context.cpp:21] [Context] Using the 'x86_shani(1way,2way)' SHA256 implementation
     52023-01-30T17:19:34.256224Z [test] [random.cpp:100] [ReportHardwareRand] Using RdSeed as an additional entropy source
     62023-01-30T17:19:34.256309Z [test] [random.cpp:103] [ReportHardwareRand] Using RdRand as an additional entropy source
     72023-01-30T17:19:34.297599Z [test] [script/sigcache.cpp:103] [InitSignatureCache] Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements
     82023-01-30T17:19:34.335885Z [test] [validation.cpp:1703] [InitScriptExecutionCache] Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements
     92023-01-30T17:19:34.336763Z [scheduler] [util/thread.cpp:20] [TraceThread] scheduler thread start
    102023-01-30T17:19:34.348812Z [test] [policy/fees.cpp:551] [CBlockPolicyEstimator] Failed to read fee estimates from /tmp/test_common_Bitcoin Core/667f5e5269ae84d88253c4870a102977a9eaf2d3f0a9c8b5c3572b5cd1a8be09/fee_estimates.dat. Continue anyway.
    112023-01-30T17:19:34.350079Z [test] [dbwrapper.cpp:158] [CDBWrapper] Opened LevelDB successfully
    122023-01-30T17:19:34.350259Z [test] [dbwrapper.cpp:183] [CDBWrapper] Using obfuscation key for /tmp/test_common_Bitcoin Core/667f5e5269ae84d88253c4870a102977a9eaf2d3f0a9c8b5c3572b5cd1a8be09/blocks/index: 0000000000000000
    132023-01-30T17:19:34.387116Z [test] [node/chainstate.cpp:39] [LoadChainstate] Assuming ancestors of block 00000000000000000009c97098b5295f7e5f183ac811fb5d1534040adb93cabd have valid signatures.
    142023-01-30T17:19:34.387228Z [test] [node/chainstate.cpp:43] [LoadChainstate] Setting nMinimumChainWork=00000000000000000000000000000000000000003404ba0801921119f903495e
    152023-01-30T17:19:34.387838Z [test] [dbwrapper.cpp:158] [CDBWrapper] Opened LevelDB successfully
    162023-01-30T17:19:34.387983Z [test] [dbwrapper.cpp:183] [CDBWrapper] Using obfuscation key for /tmp/test_common_Bitcoin Core/667f5e5269ae84d88253c4870a102977a9eaf2d3f0a9c8b5c3572b5cd1a8be09/blocks/index: 0000000000000000
    172023-01-30T17:19:34.388195Z [test] [node/blockstorage.cpp:331] [LoadBlockIndexDB] LoadBlockIndexDB: last block file = 0
    182023-01-30T17:19:34.388375Z [test] [node/blockstorage.cpp:335] [LoadBlockIndexDB] LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
    192023-01-30T17:19:34.388445Z [test] [node/blockstorage.cpp:346] [LoadBlockIndexDB] Checking all blk files are present...
    202023-01-30T17:19:34.388544Z [test] [validation.cpp:4377] [LoadBlockIndex] Initializing databases...
    212023-01-30T17:19:34.388814Z [test] [flatfile.cpp:69] [Allocate] [validation] Pre-allocating up to position 0x1000000 in blk00000.dat
    222023-01-30T17:19:34.389198Z [test] [node/chainstate.cpp:119] [LoadChainstate] Initializing chainstate Chainstate [ibd] @ height -1 (null)
    232023-01-30T17:19:34.389620Z [test] [dbwrapper.cpp:158] [CDBWrapper] Opened LevelDB successfully
    242023-01-30T17:19:34.389839Z [test] [dbwrapper.cpp:180] [CDBWrapper] Wrote new obfuscate key for /tmp/test_common_Bitcoin Core/667f5e5269ae84d88253c4870a102977a9eaf2d3f0a9c8b5c3572b5cd1a8be09/chainstate: 3ed985f8e1400ea3
    252023-01-30T17:19:34.389922Z [test] [dbwrapper.cpp:183] [CDBWrapper] Using obfuscation key for /tmp/test_common_Bitcoin Core/667f5e5269ae84d88253c4870a102977a9eaf2d3f0a9c8b5c3572b5cd1a8be09/chainstate: 3ed985f8e1400ea3
    262023-01-30T17:19:34.390169Z [test] [validation.cpp:5261] [MaybeRebalanceCaches] [snapshot] allocating all cache to the IBD chainstate
    272023-01-30T17:19:34.390283Z [test] [validation.cpp:4804] [ResizeCoinsCaches] [Chainstate [ibd] @ height -1 (null)] resized coinsdb cache to 8.0 MiB
    282023-01-30T17:19:34.390367Z [test] [validation.cpp:4806] [ResizeCoinsCaches] [Chainstate [ibd] @ height -1 (null)] resized coinsUninitialized bytes in __interceptor_strlen at offset 9 inside [0x72e00000b928, 10)
    29==44458==WARNING: MemorySanitizer: use-of-uninitialized-value
    30    [#0](/bitcoin-bitcoin/0/) 0x315b55b in sqlite3Strlen30 (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x315b55b)
    31    [#1](/bitcoin-bitcoin/1/) 0x318f7c0 in sqlite3VdbeExec (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x318f7c0)
    32    [#2](/bitcoin-bitcoin/2/) 0x3162363 in sqlite3Step (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x3162363)
    33    [#3](/bitcoin-bitcoin/3/) 0x315d941 in sqlite3_step (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x315d941)
    34    [#4](/bitcoin-bitcoin/4/) 0x3166cae in sqlite3_exec (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x3166cae)
    35    [#5](/bitcoin-bitcoin/5/) 0x1e00359 in wallet::SetPragma(sqlite3*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) src/wallet/sqlite.cpp:80:15
    36    [#6](/bitcoin-bitcoin/6/) 0x1dfe633 in wallet::SQLiteDatabase::Open() src/wallet/sqlite.cpp:243:5
    37    [#7](/bitcoin-bitcoin/7/) 0x1df9e28 in wallet::SQLiteDatabase::SQLiteDatabase(fs::path const&, fs::path const&, wallet::DatabaseOptions const&, bool) src/wallet/sqlite.cpp:113:9
    38    [#8](/bitcoin-bitcoin/8/) 0x1da4a7a in std::__1::__unique_if<wallet::SQLiteDatabase>::__unique_single std::__1::make_unique<wallet::SQLiteDatabase, char const (&) [9], char const (&) [1], wallet::DatabaseOptions&, bool>(char const (&) [9], char const (&) [1], wallet::DatabaseOptions&, bool&&) /tmp/cirrus-ci-build/ci/scratch/msan/build/include/c++/v1/memory:2068:32
    39    [#9](/bitcoin-bitcoin/9/) 0x1d92590 in wallet::CreateMockWalletDatabase(wallet::DatabaseOptions&) src/wallet/walletdb.cpp:1258:16
    40    [#10](/bitcoin-bitcoin/10/) 0x1d926db in wallet::CreateMockWalletDatabase() src/wallet/walletdb.cpp:1272:12
    41    [#11](/bitcoin-bitcoin/11/) 0x732bfb in wallet::WalletTestingSetup::WalletTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) src/wallet/test/wallet_test_fixture.cpp:13:48
    42    [#12](/bitcoin-bitcoin/12/) 0x174bc8d in wallet::feebumper::feebumper_tests::external_max_weight_test::external_max_weight_test() src/wallet/test/feebumper_tests.cpp:42:1
    43    [#13](/bitcoin-bitcoin/13/) 0x1748fd1 in wallet::feebumper::feebumper_tests::external_max_weight_test_invoker() src/wallet/test/feebumper_tests.cpp:42:1
    44    [#14](/bitcoin-bitcoin/14/) 0x81f5b3 in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/function/function_template.hpp:117:11
    45    [#15](/bitcoin-bitcoin/15/) 0x61e625 in boost::function0<void>::operator()() const /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/function/function_template.hpp:763:14
    46    [#16](/bitcoin-bitcoin/16/) 0x70a977 in boost::detail::forward::operator()() /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/execution_monitor.ipp:1388:32
    47    [#17](/bitcoin-bitcoin/17/) 0x70a476 in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/function/function_template.hpp:137:18
    48    [#18](/bitcoin-bitcoin/18/) 0x7001ed in boost::function0<int>::operator()() const /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/function/function_template.hpp:763:14
    49    [#19](/bitcoin-bitcoin/19/) 0x5c7eb3 in int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()> >(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/execution_monitor.ipp:301:30
    50    [#20](/bitcoin-bitcoin/20/) 0x54f83a in boost::execution_monitor::catch_signals(boost::function<int ()> const&) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/execution_monitor.ipp:903:16
    51    [#21](/bitcoin-bitcoin/21/) 0x54fbb6 in boost::execution_monitor::execute(boost::function<int ()> const&) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/execution_monitor.ipp:1301:16
    52    [#22](/bitcoin-bitcoin/22/) 0x545958 in boost::execution_monitor::vexecute(boost::function<void ()> const&) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/execution_monitor.ipp:1397:5
    53    [#23](/bitcoin-bitcoin/23/) 0x54a3e3 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/unit_test_monitor.ipp:49:9
    54    [#24](/bitcoin-bitcoin/24/) 0x5c4458 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/framework.ipp:815:44
    55    [#25](/bitcoin-bitcoin/25/) 0x5c2b35 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/framework.ipp:784:58
    56    [#26](/bitcoin-bitcoin/26/) 0x5c2b35 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/framework.ipp:784:58
    57    [#27](/bitcoin-bitcoin/27/) 0x5489c7 in boost::unit_test::framework::run(unsigned long, bool) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/framework.ipp:1722:29
    58    [#28](/bitcoin-bitcoin/28/) 0x56f817 in boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/unit_test_main.ipp:250:9
    59    [#29](/bitcoin-bitcoin/29/) 0x57012e in main /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/unit_test_main.ipp:306:12
    60    [#30](/bitcoin-bitcoin/30/) 0x7f356f937082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
    61    [#31](/bitcoin-bitcoin/31/) 0x4b0a3d in _start (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x4b0a3d)
    62  Uninitialized value was created by a heap allocation
    63    [#0](/bitcoin-bitcoin/0/) 0x4bcf1d in malloc (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x4bcf1d)
    64    [#1](/bitcoin-bitcoin/1/) 0x3221608 in sqlite3MemMalloc (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x3221608)
    65    [#2](/bitcoin-bitcoin/2/) 0x3157ff9 in sqlite3Malloc (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x3157ff9)
    66    [#3](/bitcoin-bitcoin/3/) 0x316b474 in setupLookaside (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x316b474)
    67    [#4](/bitcoin-bitcoin/4/) 0x316d95b in openDatabase (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x316d95b)
    68    [#5](/bitcoin-bitcoin/5/) 0x316da1a in sqlite3_open_v2 (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x316da1a)
    69    [#6](/bitcoin-bitcoin/6/) 0x1dfe3db in wallet::SQLiteDatabase::Open() src/wallet/sqlite.cpp:227:19
    70    [#7](/bitcoin-bitcoin/7/) 0x1df9e28 in wallet::SQLiteDatabase::SQLiteDatabase(fs::path const&, fs::path const&, wallet::DatabaseOptions const&, bool) src/wallet/sqlite.cpp:113:9
    71    [#8](/bitcoin-bitcoin/8/) 0x1da4a7a in std::__1::__unique_if<wallet::SQLiteDatabase>::__unique_single std::__1::make_unique<wallet::SQLiteDatabase, char const (&) [9], char const (&) [1], wallet::DatabaseOptions&, bool>(char const (&) [9], char const (&) [1], wallet::DatabaseOptions&, bool&&) /tmp/cirrus-ci-build/ci/scratch/msan/build/include/c++/v1/memory:2068:32
    72    [#9](/bitcoin-bitcoin/9/) 0x1d92590 in wallet::CreateMockWalletDatabase(wallet::DatabaseOptions&) src/wallet/walletdb.cpp:1258:16
    73    [#10](/bitcoin-bitcoin/10/) 0x1d926db in wallet::CreateMockWalletDatabase() src/wallet/walletdb.cpp:1272:12
    74    [#11](/bitcoin-bitcoin/11/) 0x732bfb in wallet::WalletTestingSetup::WalletTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) src/wallet/test/wallet_test_fixture.cpp:13:48
    75    [#12](/bitcoin-bitcoin/12/) 0x174bc8d in wallet::feebumper::feebumper_tests::external_max_weight_test::external_max_weight_test() src/wallet/test/feebumper_tests.cpp:42:1
    76    [#13](/bitcoin-bitcoin/13/) 0x1748fd1 in wallet::feebumper::feebumper_tests::external_max_weight_test_invoker() src/wallet/test/feebumper_tests.cpp:42:1
    77    [#14](/bitcoin-bitcoin/14/) 0x81f5b3 in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/function/function_template.hpp:117:11
    78    [#15](/bitcoin-bitcoin/15/) 0x61e625 in boost::function0<void>::operator()() const /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/function/function_template.hpp:763:14
    79    [#16](/bitcoin-bitcoin/16/) 0x70a977 in boost::detail::forward::operator()() /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/execution_monitor.ipp:1388:32
    80    [#17](/bitcoin-bitcoin/17/) 0x70a476 in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/function/function_template.hpp:137:18
    81    [#18](/bitcoin-bitcoin/18/) 0x7001ed in boost::function0<int>::operator()() const /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/function/function_template.hpp:763:14
    82    [#19](/bitcoin-bitcoin/19/) 0x5c7eb3 in int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()> >(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/include/boost/test/impl/execution_monitor.ipp:301:30
    83SUMMARY: MemorySanitizer: use-of-uninitialized-value (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x315b55b) in sqlite3Strlen30
    84Exiting
    85make[3]: *** [Makefile:21498: wallet/test/feebumper_tests.cpp.test] Error 1
    
  2. maflcko added the label Bug on Mar 7, 2023
  3. maflcko commented at 4:39 pm on March 7, 2023: member
    For reference, the path seems to be "" (empty string), but that shouldn’t be an issue?
  4. mohamedawnallah commented at 6:32 pm on March 16, 2023: none
    Hi @MarcoFalke, I’d like to work on this issue. Could you please let me know where I should start ?
  5. maflcko commented at 6:56 pm on March 16, 2023: member

    I am not sure. This was an intermittent issue, so it may be:

    • A bug/race in our code
    • A bug/race in sqlite
    • A bug/race in msan
    • A bug/race in the CI env
    • A bug/race somewhere else
    • A cosmic ray
  6. maflcko closed this on Apr 4, 2023

  7. fanquake commented at 3:06 pm on April 19, 2023: member
    See #27448. I’ve reproduced this (locally).
  8. maflcko reopened this on Apr 19, 2023

  9. fanquake commented at 5:45 pm on April 19, 2023: member

    See #27495, which should reproduce this, and a similar issue on aarch64:

     02023-04-19T14:57:40.859244Z [test] [validation.cpp:2834] [ConnectTip] [bench]   - Load block from disk: 0.33ms [0.00s (infms/blk)]
     12023-04-19T14:57:40.859773Z [test] [validationinterface.cpp:25Uninitialized bytes in __interceptor_strcmp at offset 0 inside [0xe01000000e0c, 1)
     2==37748==WARNING: MemorySanitizer: use-of-uninitialized-value
     3    [#0](/bitcoin-bitcoin/0/) 0xaaaab8a82008 in sqlite3BtreeOpen /home/fedora/ci_scratch/depends/work/build/aarch64-unknown-linux-gnu/sqlite/3380500-b73e7dadeab/sqlite3.c:68556:37
     4    [#1](/bitcoin-bitcoin/1/) 0xaaaab8a71ddc in openDatabase /home/fedora/ci_scratch/depends/work/build/aarch64-unknown-linux-gnu/sqlite/3380500-b73e7dadeab/sqlite3.c:171911:8
     5    [#2](/bitcoin-bitcoin/2/) 0xaaaab8a721e4 in sqlite3_open_v2 /home/fedora/ci_scratch/depends/work/build/aarch64-unknown-linux-gnu/sqlite/3380500-b73e7dadeab/sqlite3.c:172034:10
     6    [#3](/bitcoin-bitcoin/3/) 0xaaaab7c216c8 in wallet::SQLiteDatabase::Open() src/wallet/sqlite.cpp:229:19
     7    [#4](/bitcoin-bitcoin/4/) 0xaaaab7c1c39c in wallet::SQLiteDatabase::SQLiteDatabase(fs::path const&, fs::path const&, wallet::DatabaseOptions const&, bool) src/wallet/sqlite.cpp:113:9
     8    [#5](/bitcoin-bitcoin/5/) 0xaaaab7bd1304 in std::__1::__unique_if<wallet::SQLiteDatabase>::__unique_single std::__1::make_unique[abi:v160001]<wallet::SQLiteDatabase, char const (&) [9], char const (&) [1], wallet::DatabaseOptions&, bool>(char const (&) [9], char const (&) [1], wallet::DatabaseOptions&, bool&&) /home/fedora/ci_scratch/ci/scratch/msan/build/include/c++/v1/__memory/unique_ptr.h:686:30
     9    [#6](/bitcoin-bitcoin/6/) 0xaaaab7bcaab4 in wallet::CreateMockWalletDatabase(wallet::DatabaseOptions&) src/wallet/walletdb.cpp:1264:16
    10    [#7](/bitcoin-bitcoin/7/) 0xaaaab7bcaab4 in wallet::CreateMockWalletDatabase() src/wallet/walletdb.cpp:1278:12
    11    [#8](/bitcoin-bitcoin/8/) 0xaaaab6789c44 in wallet::WalletTestingSetup::WalletTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) src/wallet/test/wallet_test_fixture.cpp:13:40
    12    [#9](/bitcoin-bitcoin/9/) 0xaaaab77ba048 in wallet::wallet_tests::ComputeTimeSmart::ComputeTimeSmart() src/wallet/test/wallet_tests.cpp:407:1
    13    [#10](/bitcoin-bitcoin/10/) 0xaaaab77ba048 in wallet::wallet_tests::ComputeTimeSmart_invoker() src/wallet/test/wallet_tests.cpp:407:1
    14    [#11](/bitcoin-bitcoin/11/) 0xaaaab6852558 in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/function/function_template.hpp:117:11
    15    [#12](/bitcoin-bitcoin/12/) 0xaaaab677be68 in boost::function0<void>::operator()() const /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/function/function_template.hpp:763:14
    16    [#13](/bitcoin-bitcoin/13/) 0xaaaab677be68 in boost::detail::forward::operator()() /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/execution_monitor.ipp:1388:32
    17    [#14](/bitcoin-bitcoin/14/) 0xaaaab677be68 in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/function/function_template.hpp:137:18
    18    [#15](/bitcoin-bitcoin/15/) 0xaaaab6685144 in boost::function0<int>::operator()() const /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/function/function_template.hpp:763:14
    19    [#16](/bitcoin-bitcoin/16/) 0xaaaab6685144 in int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()>>(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/execution_monitor.ipp:301:30
    20    [#17](/bitcoin-bitcoin/17/) 0xaaaab6685144 in boost::execution_monitor::catch_signals(boost::function<int ()> const&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/execution_monitor.ipp:903:16
    21    [#18](/bitcoin-bitcoin/18/) 0xaaaab66856c8 in boost::execution_monitor::execute(boost::function<int ()> const&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/execution_monitor.ipp:1301:16
    22    [#19](/bitcoin-bitcoin/19/) 0xaaaab667dcc0 in boost::execution_monitor::vexecute(boost::function<void ()> const&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/execution_monitor.ipp:1397:5
    23    [#20](/bitcoin-bitcoin/20/) 0xaaaab667dcc0 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/unit_test_monitor.ipp:49:9
    24    [#21](/bitcoin-bitcoin/21/) 0xaaaab66e2808 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/framework.ipp:815:44
    25    [#22](/bitcoin-bitcoin/22/) 0xaaaab66e2218 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/framework.ipp:784:58
    26    [#23](/bitcoin-bitcoin/23/) 0xaaaab66e2218 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/framework.ipp:784:58
    27    [#24](/bitcoin-bitcoin/24/) 0xaaaab667ae10 in boost::unit_test::framework::run(unsigned long, bool) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/framework.ipp:1722:29
    28    [#25](/bitcoin-bitcoin/25/) 0xaaaab66aadb4 in boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/unit_test_main.ipp:250:9
    29    [#26](/bitcoin-bitcoin/26/) 0xaaaab66abb98 in main /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/unit_test_main.ipp:306:12
    30    [#27](/bitcoin-bitcoin/27/) 0xffff91066dbc  (/lib/aarch64-linux-gnu/libc.so.6+0x26dbc) (BuildId: 9efe43e32e614cad22a180ef036eea6154eafdc2)
    31    [#28](/bitcoin-bitcoin/28/) 0xffff91066e94 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x26e94) (BuildId: 9efe43e32e614cad22a180ef036eea6154eafdc2)
    32    [#29](/bitcoin-bitcoin/29/) 0xaaaab65cd6ec in _start (/home/fedora/ci_scratch/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/src/test/test_bitcoin+0x15d6ec) (BuildId: 78bb98243eb0da25c31e795ae10bd1ff4597c7e4)
    33
    34  Uninitialized value was created by a heap allocation
    35    [#0](/bitcoin-bitcoin/0/) 0xaaaab65ffd14 in malloc (/home/fedora/ci_scratch/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/src/test/test_bitcoin+0x18fd14) (BuildId: 78bb98243eb0da25c31e795ae10bd1ff4597c7e4)
    36    [#1](/bitcoin-bitcoin/1/) 0xaaaab8bb18d4 in sqlite3MemMalloc /home/fedora/ci_scratch/depends/work/build/aarch64-unknown-linux-gnu/sqlite/3380500-b73e7dadeab/sqlite3.c:25163:7
    37    [#2](/bitcoin-bitcoin/2/) 0xaaaab8a77948 in mallocWithAlarm /home/fedora/ci_scratch/depends/work/build/aarch64-unknown-linux-gnu/sqlite/3380500-b73e7dadeab/sqlite3.c:28846:7
    38    [#3](/bitcoin-bitcoin/3/) 0xaaaab8a508bc in sqlite3Malloc /home/fedora/ci_scratch/depends/work/build/aarch64-unknown-linux-gnu/sqlite/3380500-b73e7dadeab/sqlite3.c:28876:5
    39    [#4](/bitcoin-bitcoin/4/) 0xaaaab8a5096c in sqlite3_malloc64 /home/fedora/ci_scratch/depends/work/build/aarch64-unknown-linux-gnu/sqlite/3380500-b73e7dadeab/sqlite3.c:28900:10
    40    [#5](/bitcoin-bitcoin/5/) 0xaaaab8b9aca4 in sqlite3ParseUri /home/fedora/ci_scratch/depends/work/build/aarch64-unknown-linux-gnu/sqlite/3380500-b73e7dadeab/sqlite3.c:171638:13
    41    [#6](/bitcoin-bitcoin/6/) 0xaaaab8a71d34 in openDatabase /home/fedora/ci_scratch/depends/work/build/aarch64-unknown-linux-gnu/sqlite/3380500-b73e7dadeab/sqlite3.c:171901:10
    42    [#7](/bitcoin-bitcoin/7/) 0xaaaab8a721e4 in sqlite3_open_v2 /home/fedora/ci_scratch/depends/work/build/aarch64-unknown-linux-gnu/sqlite/3380500-b73e7dadeab/sqlite3.c:172034:10
    43    [#8](/bitcoin-bitcoin/8/) 0xaaaab7c216c8 in wallet::SQLiteDatabase::Open() src/wallet/sqlite.cpp:229:19
    44    [#9](/bitcoin-bitcoin/9/) 0xaaaab7c1c39c in wallet::SQLiteDatabase::SQLiteDatabase(fs::path const&, fs::path const&, wallet::DatabaseOptions const&, bool) src/wallet/sqlite.cpp:113:9
    45    [#10](/bitcoin-bitcoin/10/) 0xaaaab7bd1304 in std::__1::__unique_if<wallet::SQLiteDatabase>::__unique_single std::__1::make_unique[abi:v160001]<wallet::SQLiteDatabase, char const (&) [9], char const (&) [1], wallet::DatabaseOptions&, bool>(char const (&) [9], char const (&) [1], wallet::DatabaseOptions&, bool&&) /home/fedora/ci_scratch/ci/scratch/msan/build/include/c++/v1/__memory/unique_ptr.h:686:30
    46    [#11](/bitcoin-bitcoin/11/) 0xaaaab7bcaab4 in wallet::CreateMockWalletDatabase(wallet::DatabaseOptions&) src/wallet/walletdb.cpp:1264:16
    47    [#12](/bitcoin-bitcoin/12/) 0xaaaab7bcaab4 in wallet::CreateMockWalletDatabase() src/wallet/walletdb.cpp:1278:12
    48    [#13](/bitcoin-bitcoin/13/) 0xaaaab6789c44 in wallet::WalletTestingSetup::WalletTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) src/wallet/test/wallet_test_fixture.cpp:13:40
    49    [#14](/bitcoin-bitcoin/14/) 0xaaaab77ba048 in wallet::wallet_tests::ComputeTimeSmart::ComputeTimeSmart() src/wallet/test/wallet_tests.cpp:407:1
    50    [#15](/bitcoin-bitcoin/15/) 0xaaaab77ba048 in wallet::wallet_tests::ComputeTimeSmart_invoker() src/wallet/test/wallet_tests.cpp:407:1
    51    [#16](/bitcoin-bitcoin/16/) 0xaaaab6852558 in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/function/function_template.hpp:117:11
    52    [#17](/bitcoin-bitcoin/17/) 0xaaaab677be68 in boost::function0<void>::operator()() const /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/function/function_template.hpp:763:14
    53    [#18](/bitcoin-bitcoin/18/) 0xaaaab677be68 in boost::detail::forward::operator()() /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/execution_monitor.ipp:1388:32
    54    [#19](/bitcoin-bitcoin/19/) 0xaaaab677be68 in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/function/function_template.hpp:137:18
    55    [#20](/bitcoin-bitcoin/20/) 0xaaaab6685144 in boost::function0<int>::operator()() const /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/function/function_template.hpp:763:14
    56    [#21](/bitcoin-bitcoin/21/) 0xaaaab6685144 in int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()>>(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/execution_monitor.ipp:301:30
    57    [#22](/bitcoin-bitcoin/22/) 0xaaaab6685144 in boost::execution_monitor::catch_signals(boost::function<int ()> const&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/execution_monitor.ipp:903:16
    58    [#23](/bitcoin-bitcoin/23/) 0xaaaab66856c8 in boost::execution_monitor::execute(boost::function<int ()> const&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/execution_monitor.ipp:1301:16
    59    [#24](/bitcoin-bitcoin/24/) 0xaaaab667dcc0 in boost::execution_monitor::vexecute(boost::function<void ()> const&) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/execution_monitor.ipp:1397:5
    60    [#25](/bitcoin-bitcoin/25/) 0xaaaab667dcc0 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/unit_test_monitor.ipp:49:9
    61    [#26](/bitcoin-bitcoin/26/) 0xaaaab66e2808 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /home/fedora/ci_scratch/depends/aarch64-unknown-linux-gnu/include/boost/test/impl/framework.ipp:815:44
    62
    63SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/fedora/ci_scratch/depends/work/build/aarch64-unknown-linux-gnu/sqlite/3380500-b73e7dadeab/sqlite3.c:68556:37 in sqlite3BtreeOpen
    64Exiting
    
  10. maflcko commented at 9:26 am on April 20, 2023: member
    Too bad this doesn’t easily reproduce outside of the CI env with valgrind. I guess if someone wants to take a look, it might be easiest to fiddle inside the CI env interactively.
  11. achow101 commented at 0:11 am on May 18, 2023: member

    This looks to be an issue with either sqlite or clang, I don’t think there’s anything that we can do to resolve these other than suppressing them.

    MSan is tripping on sqlite calling strlen on a string that it copied into a temp buffer. That temp buffer was malloc’d by sqlite (without clearing out the data, so it has uninitialized memory), and then our string copied into it, maybe modified (this particular function normalizes a path), a null terminator added, and the result strlen’d. That last strlen is where msan is tripping. It seems like msan is tripping on the null terminator and thinking that it is uninitialized memory, so that sounds like an issue with clang rather than sqlite.

    In https://github.com/achow101/bitcoin/commit/70bf5dae3100ce665274d45f353e79a677baecb4, I added a patch which uses memset to initialize that particular buffer, and that seems to resolve this particular sanitizer issue. However it then proceeds to trip later somewhere else (https://cirrus-ci.com/task/6411320392679424) for presumably a similar problem as it’s also on a strlen call.

    In general, I don’t think this is a problem that we can fix.

  12. maflcko commented at 5:50 am on May 18, 2023: member
    Ok, thanks for taking a look. If there is a reduced test case, it could make sense to report something upstream.
  13. maflcko commented at 8:54 am on June 21, 2023: member
    Maybe sqlite in depends doesn’t pick up all the build flags? See also the unrelated workaround in https://github.com/google/oss-fuzz/commit/171c9131f7de5b4bc79800001b0a8fc5efa80cc5
  14. fanquake commented at 8:58 am on June 21, 2023: member

    Maybe sqlite in depends doesn’t pick up all the build flags?

    It looks like it doesn’t, at least in some configurations, needs some more investigation. The oss-fuzz workaround is a hack to pass one “make it build” flag through using cppflags.

  15. maflcko commented at 12:15 pm on January 25, 2024: member
  16. maflcko closed this on Jan 25, 2024


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-23 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me