Guest User

Untitled

a guest
Aug 3rd, 2020
42
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Run script:
  2. $ cat tryForKuba.sh
  3. # With and without the original patch.
  4. NO_D84570=/home/nemanjai/llvm/Git/trunk1/install/bin/clang
  5. WITH_D84570=/home/nemanjai/llvm/Git/trunk1/build/bin/clang
  6. $NO_D84570 -O0 variadic-tsan.cpp -o clean.O0
  7. $NO_D84570 -O1 variadic-tsan.cpp -o clean.O1
  8. $NO_D84570 -O2 variadic-tsan.cpp -o clean.O2
  9.  
  10. $NO_D84570 -O0 variadic-tsan.cpp -fsanitize=thread -o clean.tsan.O0
  11. $NO_D84570 -O1 variadic-tsan.cpp -fsanitize=thread -o clean.tsan.O1
  12. $NO_D84570 -O2 variadic-tsan.cpp -fsanitize=thread -o clean.tsan.O2
  13.  
  14. $WITH_D84570 -O0 variadic-tsan.cpp -o d84570.O0
  15. $WITH_D84570 -O1 variadic-tsan.cpp -o d84570.O1
  16. $WITH_D84570 -O2 variadic-tsan.cpp -o d84570.O2
  17.  
  18. $WITH_D84570 -O0 variadic-tsan.cpp -fsanitize=thread -o d84570.tsan.O0
  19. $WITH_D84570 -O1 variadic-tsan.cpp -fsanitize=thread -o d84570.tsan.O1
  20. $WITH_D84570 -O2 variadic-tsan.cpp -fsanitize=thread -o d84570.tsan.O2
  21.  
  22. # Apply the additional patch and try again.
  23. echo "Applying the following patch"
  24. cat $LLVM_SRC/NewPatch.diff
  25. cd $LLVM_SRC/..
  26. git apply $LLVM_SRC/NewPatch.diff
  27. cd /home/nemanjai/llvm/Git/trunk1/build
  28. ninja
  29. cd $LLVM_SRC
  30. WITH_BOTH=/home/nemanjai/llvm/Git/trunk1/build/bin/clang
  31. $WITH_BOTH -O0 variadic-tsan.cpp -o both.O0
  32. $WITH_BOTH -O1 variadic-tsan.cpp -o both.O1
  33. $WITH_BOTH -O2 variadic-tsan.cpp -o both.O2
  34.  
  35. $WITH_BOTH -O0 variadic-tsan.cpp -fsanitize=thread -o both.tsan.O0
  36. $WITH_BOTH -O1 variadic-tsan.cpp -fsanitize=thread -o both.tsan.O1
  37. $WITH_BOTH -O2 variadic-tsan.cpp -fsanitize=thread -o both.tsan.O2
  38.  
  39. for EXE in clean.O0 clean.O1 clean.O2 clean.tsan.O0 clean.tsan.O1 clean.tsan.O2 \
  40.            d84570.O0 d84570.O1 d84570.O2 d84570.tsan.O0 d84570.tsan.O1 d84570.tsan.O2 \
  41.            both.O0 both.O1 both.O2 both.tsan.O0 both.tsan.O1 both.tsan.O2
  42. do
  43.   echo "Running $EXE:"
  44.   ./$EXE tmp.txt
  45.   echo -e "\n\n"
  46. done
  47.  
  48. # Run the script:
  49. $ ./tryForKuba.sh
  50. Applying the following patch
  51. diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
  52. --- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
  53. +++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
  54. @@ -137,7 +137,11 @@ const int PTHREAD_BARRIER_SERIAL_THREAD = -1;
  55.  #endif
  56.  const int MAP_FIXED = 0x10;
  57.  typedef long long_t;
  58. +#if SANITIZER_MAC || SANITIZER_FREEBSD || SANITIZER_NETBSD
  59.  typedef __sanitizer::u16 mode_t;
  60. +#else
  61. +typedef __sanitizer::u32 mode_t;
  62. +#endif
  63.  
  64.  // From /usr/include/unistd.h
  65.  # define F_ULOCK 0      /* Unlock a previously locked region.  */
  66. [0/7] Performing build step for 'builtins'
  67. ninja: no work to do.
  68. [1/7] No install step for 'builtins'
  69. [3/7] Performing configure step for 'runtimes'
  70. -- Building with -fPIC
  71. -- Compiler-RT supported architectures: powerpc64le
  72. -- check-cfi does nothing.
  73. -- check-cfi-and-supported does nothing.
  74. -- Generated Sanitizer SUPPORTED_TOOLS list on "Linux" is "asan;lsan;msan;tsan;ubsan"
  75. -- sanitizer_common tests on "Linux" will run against "asan;lsan;msan;tsan;ubsan"
  76. -- check-scudo_standalone does nothing.
  77. -- check-shadowcallstack does nothing.
  78. Traceback (most recent call last):
  79.   File "<string>", line 22, in <module>
  80. IndexError: list index out of range
  81. -- Configuring done
  82. -- Generating done
  83. -- Build files have been written to: /home/nemanjai/llvm/Git/trunk1/build/runtimes/runtimes-bins
  84. [4/7] Performing build step for 'runtimes'
  85. [7/7] Generating exported symbols for clang_rt.tsan-powerpc64le
  86. [5/7] No install step for 'runtimes'
  87. [7/7] Completed 'runtimes'
  88. Running clean.O0:
  89. Hello world.
  90. permissions = 0600
  91. Done.
  92.  
  93.  
  94.  
  95. Running clean.O1:
  96. Hello world.
  97. permissions = 0600
  98. Done.
  99.  
  100.  
  101.  
  102. Running clean.O2:
  103. Hello world.
  104. permissions = 0600
  105. Done.
  106.  
  107.  
  108.  
  109. Running clean.tsan.O0:
  110. Hello world.
  111. permissions = 010
  112. clean.tsan.O0: variadic-tsan.cpp:16: int main(int, char **): Assertion `result == 0' failed.
  113. ./tryForKuba.sh: line 37: 142475 Aborted                 ./$EXE tmp.txt
  114.  
  115.  
  116.  
  117. Running clean.tsan.O1:
  118. Hello world.
  119. permissions = 01
  120. clean.tsan.O1: variadic-tsan.cpp:16: int main(int, char **): Assertion `result == 0' failed.
  121. ./tryForKuba.sh: line 37: 142476 Aborted                 ./$EXE tmp.txt
  122.  
  123.  
  124.  
  125. Running clean.tsan.O2:
  126. Hello world.
  127. permissions = 0600
  128. Done.
  129.  
  130.  
  131.  
  132. Running d84570.O0:
  133. Hello world.
  134. permissions = 0600
  135. Done.
  136.  
  137.  
  138.  
  139. Running d84570.O1:
  140. Hello world.
  141. permissions = 0600
  142. Done.
  143.  
  144.  
  145.  
  146. Running d84570.O2:
  147. Hello world.
  148. permissions = 0600
  149. Done.
  150.  
  151.  
  152.  
  153. Running d84570.tsan.O0:
  154. Hello world.
  155. permissions = 010
  156. d84570.tsan.O0: variadic-tsan.cpp:16: int main(int, char **): Assertion `result == 0' failed.
  157. ./tryForKuba.sh: line 37: 142481 Aborted                 ./$EXE tmp.txt
  158.  
  159.  
  160.  
  161. Running d84570.tsan.O1:
  162. Hello world.
  163. permissions = 01
  164. d84570.tsan.O1: variadic-tsan.cpp:16: int main(int, char **): Assertion `result == 0' failed.
  165. ./tryForKuba.sh: line 37: 142482 Aborted                 ./$EXE tmp.txt
  166.  
  167.  
  168.  
  169. Running d84570.tsan.O2:
  170. Hello world.
  171. permissions = 0600
  172. Done.
  173.  
  174.  
  175.  
  176. Running both.O0:
  177. Hello world.
  178. permissions = 0600
  179. Done.
  180.  
  181.  
  182.  
  183. Running both.O1:
  184. Hello world.
  185. permissions = 0600
  186. Done.
  187.  
  188.  
  189.  
  190. Running both.O2:
  191. Hello world.
  192. permissions = 0600
  193. Done.
  194.  
  195.  
  196.  
  197. Running both.tsan.O0:
  198. Hello world.
  199. permissions = 010
  200. both.tsan.O0: variadic-tsan.cpp:16: int main(int, char **): Assertion `result == 0' failed.
  201. ./tryForKuba.sh: line 37: 142487 Aborted                 ./$EXE tmp.txt
  202.  
  203.  
  204.  
  205. Running both.tsan.O1:
  206. Hello world.
  207. permissions = 01
  208. both.tsan.O1: variadic-tsan.cpp:16: int main(int, char **): Assertion `result == 0' failed.
  209. ./tryForKuba.sh: line 37: 142488 Aborted                 ./$EXE tmp.txt
  210.  
  211.  
  212.  
  213. Running both.tsan.O2:
  214. Hello world.
  215. permissions = 0600
  216. Done.
  217.  
  218.  
  219.  
  220.  
RAW Paste Data