sanitize_blacklist.txt 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. # Configuration Flags:
  30. # -fno-sanitize-recover=all
  31. # causes clang to crash on undefined behavior, rather than printing
  32. # a warning and continuing (the AddressSanitizer always crashes)
  33. # -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-inline
  34. # make clang backtraces easier to read
  35. # --disable-gcc-hardening
  36. # disables warnings about the redefinition of _FORTIFY_SOURCE
  37. # (it conflicts with the sanitizers)
  38. # Turning the sanitizers off for particular functions:
  39. # (Unfortunately, exempting functions doesn't work for the blacklisted
  40. # functions below, and we can't turn the code off because it's essential)
  41. #
  42. # #if defined(__has_feature)
  43. # #if __has_feature(address_sanitizer)
  44. # /* tell clang AddressSanitizer not to instrument this function */
  45. # #define NOASAN __attribute__((no_sanitize_address))
  46. # #define _CLANG_ASAN_
  47. # #else
  48. # #define NOASAN
  49. # #endif
  50. # #else
  51. # #define NOASAN
  52. # #endif
  53. #
  54. # /* Telling AddressSanitizer to not instrument a function */
  55. # void func(void) NOASAN;
  56. #
  57. # /* Including or excluding sections of code */
  58. # #ifdef _CLANG_ASAN_
  59. # /* code that only runs under address sanitizer */
  60. # #else
  61. # /* code that doesn't run under address sanitizer */
  62. # #endif
  63. # Blacklist Entries:
  64. # we need to allow the tor bt handler to catch SIGSEGV
  65. # otherwise address sanitizer munges the expected output and the test fails
  66. # we can do this by setting an environmental variable
  67. # See https://code.google.com/p/address-sanitizer/wiki/Flags
  68. # ASAN_OPTIONS=allow_user_segv_handler=1
  69. # test-memwipe.c checks if a freed buffer was properly wiped
  70. fun:vmemeq
  71. fun:check_a_buffer
  72. # test_bt_cl.c stores to a NULL pointer to trigger a crash
  73. fun:crash
  74. # curve25519-donna.c left-shifts 1 bits into and past the sign bit of signed
  75. # integers. Until #13538 is resolved, we can exempt the entire file from all
  76. # analysis under clang's undefined behavior sanitizer.
  77. # This may be overkill, but it works, and is easier than listing every
  78. # function in the file.
  79. # Note that x86_64 uses curve25519-donna-c64.c instead of curve25519-donna.c
  80. src:src/ext/curve25519_donna/curve25519-donna.c