sanitize_blacklist.txt 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # clang sanitizer special case list
  2. # syntax specified in http://clang.llvm.org/docs/SanitizerSpecialCaseList.html
  3. # for more info see http://clang.llvm.org/docs/AddressSanitizer.html
  4. # usage:
  5. # 1. configure tor build:
  6. # ./configure \
  7. # CC=clang \
  8. # CFLAGS="-fsanitize-blacklist=contrib/clang/sanitize_blacklist.txt -fsanitize=undefined -fsanitize=address -fno-sanitize-recover=all -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-inline" \
  9. # LDFLAGS="-fsanitize=address" \
  10. # --disable-gcc-hardening
  11. # and any other flags required to build tor on your OS.
  12. #
  13. # 2. build tor:
  14. # make
  15. #
  16. # 3. test tor:
  17. # ASAN_OPTIONS=allow_user_segv_handler=1 make test
  18. # ASAN_OPTIONS=allow_user_segv_handler=1 make check
  19. # make test-network # requires chutney
  20. #
  21. # 4. the tor binary is now instrumented with clang sanitizers,
  22. # and can be run just like a standard tor binary
  23. # Compatibility:
  24. # This blacklist has been tested with clang 3.7's UndefinedBehaviorSanitizer
  25. # and AddressSanitizer on OS X 10.10 Yosemite, with all tests passing
  26. # on both x86_64 and i386 (using CC="clang -arch i386")
  27. # It has not been tested with ThreadSanitizer or MemorySanitizer
  28. # Success report and patches for other sanitizers or OSs are welcome
  29. # ccache and make don't account for the sanitizer blacklist as a dependency
  30. # you might need to set CCACHE_DISABLE=1 and/or use make clean to workaround
  31. # Configuration Flags:
  32. # -fno-sanitize-recover=all
  33. # causes clang to crash on undefined behavior, rather than printing
  34. # a warning and continuing (the AddressSanitizer always crashes)
  35. # -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-inline
  36. # make clang backtraces easier to read
  37. # --disable-gcc-hardening
  38. # disables warnings about the redefinition of _FORTIFY_SOURCE
  39. # (it conflicts with the sanitizers)
  40. # Turning the sanitizers off for particular functions:
  41. # (Unfortunately, exempting functions doesn't work for the blacklisted
  42. # functions below, and we can't turn the code off because it's essential)
  43. #
  44. # #if defined(__has_feature)
  45. # #if __has_feature(address_sanitizer)
  46. # /* tell clang AddressSanitizer not to instrument this function */
  47. # #define NOASAN __attribute__((no_sanitize_address))
  48. # #define _CLANG_ASAN_
  49. # #else
  50. # #define NOASAN
  51. # #endif
  52. # #else
  53. # #define NOASAN
  54. # #endif
  55. #
  56. # /* Telling AddressSanitizer to not instrument a function */
  57. # void func(void) NOASAN;
  58. #
  59. # /* Including or excluding sections of code */
  60. # #ifdef _CLANG_ASAN_
  61. # /* code that only runs under address sanitizer */
  62. # #else
  63. # /* code that doesn't run under address sanitizer */
  64. # #endif
  65. # Blacklist Entries:
  66. # test-memwipe.c checks if a freed buffer was properly wiped
  67. fun:vmemeq
  68. fun:check_a_buffer
  69. # we need to allow the tor bt handler to catch SIGSEGV
  70. # otherwise address sanitizer munges the expected output and the test fails
  71. # we can do this by setting an environmental variable
  72. # See https://code.google.com/p/address-sanitizer/wiki/Flags
  73. # ASAN_OPTIONS=allow_user_segv_handler=1
  74. # test_bt_cl.c stores to a NULL pointer to trigger a crash
  75. fun:crash
  76. # curve25519-donna.c left-shifts 1 bits into and past the sign bit of signed
  77. # integers. Until #13538 is resolved, we exempt functions that do left shifts.
  78. # Note that x86_64 uses curve25519-donna-c64.c instead of curve25519-donna.c
  79. fun:freduce_coefficients
  80. fun:freduce_degree
  81. fun:s32_eq
  82. fun:fcontract