tests: Add AddressSanitizer (ASan) Travis build #14794

pull practicalswift wants to merge 3 commits into bitcoin:master from practicalswift:asan-in-travis changing 5 files +23 −6
  1. practicalswift commented at 3:51 PM on November 23, 2018: contributor

    Add ASan Travis build.

  2. in .travis.yml:105 in 99aa5fd0c8 outdated
     101 | @@ -102,6 +102,16 @@ jobs:
     102 |          RUN_FUNCTIONAL_TESTS=false # Disabled for now. TODO identify suppressions or exclude specific tests
     103 |          GOAL="install"
     104 |          BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=thread --disable-hardening --disable-asm CC=clang CXX=clang++"
     105 | +# x86_64 Linux (xenial, no depends, only system libs, sanitizers: address (ASAN))
    


    MarcoFalke commented at 7:02 PM on November 23, 2018:

    Could this be combined with the bionic sanitizer build below instead (assuming that the functional tests pass)?

  3. fanquake added the label Tests on Nov 23, 2018
  4. sipa commented at 12:31 PM on November 24, 2018: member

    Any reason to not enable ASan and UBSan in the same test?

  5. practicalswift force-pushed on Nov 25, 2018
  6. practicalswift force-pushed on Nov 25, 2018
  7. practicalswift force-pushed on Nov 25, 2018
  8. in test/functional/p2p_invalid_messages.py:73 in 38bff2be99 outdated
      66 | @@ -66,7 +67,10 @@ def run_test(self):
      67 |          msg_at_size = msg_unrecognized("b" * valid_data_limit)
      68 |          assert len(msg_at_size.serialize()) == msg_limit
      69 |  
      70 | -        with node.assert_memory_usage_stable(perc_increase_allowed=0.03):
      71 | +        perc_increase_allowed = 0.03
      72 | +        if [s for s in os.environ.get("BITCOIN_CONFIG", "").split(" ") if "--with-sanitizers" in s and "address" in s]:
      73 | +            perc_increase_allowed = 3.5
      74 | +        with node.assert_memory_usage_stable(perc_increase_allowed=perc_increase_allowed):
    


    MarcoFalke commented at 10:50 PM on November 25, 2018:

    I think the test fails unrelated to the sanitizer?


    practicalswift commented at 10:55 PM on November 25, 2018:

    I'm not so sure about that: could it be that this failure is intermittent without ASan and consistent with ASan? :-) It appears to be consistently triggered under ASan for me.

  9. in .travis/test_04_install.sh:10 in 38bff2be99 outdated
       6 | @@ -7,9 +7,10 @@
       7 |  export LC_ALL=C.UTF-8
       8 |  
       9 |  travis_retry docker pull "$DOCKER_NAME_TAG"
      10 | +export ASAN_OPTIONS="leak_check_at_exit=0"
    


    MarcoFalke commented at 10:52 PM on November 25, 2018:

    Could only suppress these for the gui and wallet?

  10. practicalswift force-pushed on Nov 25, 2018
  11. practicalswift force-pushed on Nov 25, 2018
  12. practicalswift force-pushed on Nov 25, 2018
  13. practicalswift force-pushed on Nov 25, 2018
  14. practicalswift force-pushed on Nov 26, 2018
  15. practicalswift force-pushed on Nov 26, 2018
  16. practicalswift force-pushed on Nov 26, 2018
  17. practicalswift renamed this:
    [wip] Add ASan Travis build
    Add ASan Travis build
    on Nov 26, 2018
  18. practicalswift commented at 1:37 PM on November 26, 2018: contributor

    @sipa I was afraid the combined runtime would be too long, but it appears to work. The two Travis jobs have now been merged. Please review. @MarcoFalke Now running also with LSan (LeakSanitizer). Please review :-)

  19. MarcoFalke commented at 4:30 PM on November 26, 2018: member

    Could squash everything except the changes in test/functional?

  20. practicalswift renamed this:
    Add ASan Travis build
    Add AddressSanitizer (ASan) Travis build
    on Nov 26, 2018
  21. practicalswift force-pushed on Nov 26, 2018
  22. practicalswift commented at 4:48 PM on November 26, 2018: contributor

    @MarcoFalke Done! Please re-review :-)

  23. in test/sanitizer_suppressions/lsan:2 in 20a67691d1 outdated
       0 | @@ -0,0 +1,7 @@
       1 | +leak:addCoin
    


    MarcoFalke commented at 5:00 PM on November 26, 2018:

    Could add a commit with some documentation about those (see my tsan file in this folder for example):

    • addCoin is some bench test that doesn't primarily care about leaks.
    • The lib* ones are likely upstream false-positives
    • ...
  24. MarcoFalke approved
  25. MarcoFalke renamed this:
    Add AddressSanitizer (ASan) Travis build
    tests: Add AddressSanitizer (ASan) Travis build
    on Nov 26, 2018
  26. practicalswift commented at 9:07 PM on November 26, 2018: contributor

    @MarcoFalke Added comments as suggested. Please re-review :-)

  27. practicalswift force-pushed on Nov 26, 2018
  28. Make test p2p_invalid_messages.py pass: Allow for expected Travis ASAN memory increase ebd3bf2590
  29. Add ASan Travis build ff7212ec32
  30. practicalswift force-pushed on Nov 26, 2018
  31. in test/sanitizer_suppressions/lsan:10 in 3f9b8243d7 outdated
       5 | +leak:libcrypto
       6 | +leak:libqminimal
       7 | +leak:libQt5Core
       8 | +leak:libQt5Gui
       9 | +leak:libQt5Widgets
      10 | +leak:new_allocator.h
    


    MarcoFalke commented at 9:22 PM on November 26, 2018:

    Should suppress the specific benchmark where this is happening, not the gcc internal


    practicalswift commented at 9:53 PM on November 26, 2018:

    This is the output I'm getting:

    $ ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-6.0/bin/llvm-symbolizer ASAN_OPTIONS="" LSAN_OPTIONS="suppressions=$(pwd)/test/sanitizer_suppressions/lsan" src/bench/bench_bitcoin -evals=1 -scaling=0
    # Benchmark, evals, iterations, total, min, max, median
    …
    
    =================================================================
    ==890==ERROR: LeakSanitizer: detected memory leaks
    
    Indirect leak of 40040 byte(s) in 1001 object(s) allocated from:
        [#0](/bitcoin-bitcoin/0/) 0x535d60 in operator new(unsigned long) (/…/bitcoin/src/bench/bench_bitcoin+0x535d60)
        [#1](/bitcoin-bitcoin/1/) 0x5cd895 in __gnu_cxx::new_allocator<CTxOut>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/ext/new_allocator.h:111:27
        [#2](/bitcoin-bitcoin/2/) 0x5cd895 in std::allocator_traits<std::allocator<CTxOut> >::allocate(std::allocator<CTxOut>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/alloc_traits.h:436
        [#3](/bitcoin-bitcoin/3/) 0x5cd895 in std::_Vector_base<CTxOut, std::allocator<CTxOut> >::_M_allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_vector.h:172
        [#4](/bitcoin-bitcoin/4/) 0x5cd895 in std::vector<CTxOut, std::allocator<CTxOut> >::_M_default_append(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/vector.tcc:571
    
    -----------------------------------------------------
    Suppressions used:
      count      bytes template
       2002     392392 addCoin
    -----------------------------------------------------
    
    SUMMARY: AddressSanitizer: 40040 byte(s) leaked in 1001 allocation(s).
    

    Note the absence of the benchmark name in the symbolized stack trace.


    practicalswift commented at 10:02 PM on November 26, 2018:

    I've now adjusted the suppressions file. Now using leak:__gnu_cxx::new_allocator<CTxOut>::allocate which is a bit more specific. Please re-review :-)


    MarcoFalke commented at 10:09 PM on November 26, 2018:

    Would leak:src/bench work?


    practicalswift commented at 10:32 PM on November 26, 2018:

    Updated. Please re-review! :-)

  32. MarcoFalke dismissed
  33. practicalswift force-pushed on Nov 26, 2018
  34. practicalswift force-pushed on Nov 26, 2018
  35. Add LSan suppression warnings 6541d59ddc
  36. practicalswift force-pushed on Nov 26, 2018
  37. MarcoFalke merged this on Nov 27, 2018
  38. MarcoFalke closed this on Nov 27, 2018

  39. MarcoFalke referenced this in commit 600b85bb41 on Nov 27, 2018
  40. deadalnix referenced this in commit a382f87da6 on May 21, 2020
  41. MarcoFalke referenced this in commit 7027c67cac on Jul 2, 2020
  42. ftrader referenced this in commit ab6e90f067 on Aug 17, 2020
  43. practicalswift deleted the branch on Apr 10, 2021
  44. kittywhiskers referenced this in commit fcdea84cce on Aug 5, 2021
  45. kittywhiskers referenced this in commit 8792cbb540 on Aug 5, 2021
  46. kittywhiskers referenced this in commit a5f8a41bbc on Aug 12, 2021
  47. kittywhiskers referenced this in commit 27a667e91a on Aug 22, 2021
  48. kittywhiskers referenced this in commit c6b107e8d9 on Aug 30, 2021
  49. vijaydasmp referenced this in commit 32a14213f2 on Sep 24, 2021
  50. vijaydasmp referenced this in commit 549d38d943 on Sep 25, 2021
  51. vijaydasmp referenced this in commit 7a1683891d on Sep 25, 2021
  52. vijaydasmp referenced this in commit c76671d664 on Sep 27, 2021
  53. vijaydasmp referenced this in commit 77ddb4b4ac on Sep 28, 2021
  54. vijaydasmp referenced this in commit 075c93be11 on Sep 28, 2021
  55. vijaydasmp referenced this in commit 8f513ef90d on Sep 30, 2021
  56. vijaydasmp referenced this in commit 007d993084 on Oct 1, 2021
  57. vijaydasmp referenced this in commit 8b879c0c9f on Oct 1, 2021
  58. vijaydasmp referenced this in commit 3d9ac56e04 on Oct 2, 2021
  59. vijaydasmp referenced this in commit 0a5485a9a4 on Oct 2, 2021
  60. vijaydasmp referenced this in commit dfa262c93f on Oct 4, 2021
  61. Munkybooty referenced this in commit 4a8fed46d2 on Dec 28, 2021
  62. Munkybooty referenced this in commit 787b098c05 on Dec 28, 2021
  63. Munkybooty referenced this in commit ef37894012 on Dec 28, 2021
  64. Munkybooty referenced this in commit 4a1ded4a10 on Dec 28, 2021
  65. Munkybooty referenced this in commit d63f010db6 on Dec 28, 2021
  66. Munkybooty referenced this in commit 6a9b1e88a7 on Jan 3, 2022
  67. Munkybooty referenced this in commit b58970ab1d on Feb 1, 2022
  68. Munkybooty referenced this in commit eb1ddaf832 on Feb 16, 2022
  69. Munkybooty referenced this in commit 3a2135f171 on Feb 24, 2022
  70. Munkybooty referenced this in commit 1bed846dc3 on Feb 24, 2022
  71. Munkybooty referenced this in commit e7efb9482b on Mar 6, 2022
  72. Munkybooty referenced this in commit 99ef216933 on Mar 20, 2022
  73. kittywhiskers referenced this in commit 8b6ae1eb59 on Mar 25, 2022
  74. kittywhiskers referenced this in commit 274d35dfb6 on Apr 7, 2022
  75. Munkybooty referenced this in commit 81578b35ee on Apr 21, 2022
  76. Munkybooty referenced this in commit b03cd828bf on Apr 26, 2022
  77. Munkybooty referenced this in commit b3ceb1ae47 on Apr 29, 2022
  78. Munkybooty referenced this in commit 10d3657d25 on May 10, 2022
  79. Munkybooty referenced this in commit 6b2a408890 on May 12, 2022
  80. Munkybooty referenced this in commit bf18695b42 on May 12, 2022
  81. Munkybooty referenced this in commit f6ddf04345 on May 17, 2022
  82. Munkybooty referenced this in commit 22ae9fde91 on May 23, 2022
  83. kittywhiskers referenced this in commit 0730f629bb on Jun 22, 2022
  84. kittywhiskers referenced this in commit e22b5b7a5f on Jul 1, 2022
  85. UdjinM6 referenced this in commit ef8cf4bfea on Jul 2, 2022
  86. DrahtBot locked this on Aug 18, 2022

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: 2026-04-13 18:15 UTC

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