[PATCH] D145214: [TSAN] add support for riscv64

Alex Fan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 3 23:16:30 PST 2023


alexfanqi created this revision.
Herald added subscribers: luke, Enna1, VincentWu, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, fedor.sergeev, arichardson.
Herald added a project: All.
alexfanqi updated this revision to Diff 502351.
alexfanqi added a comment.
alexfanqi retitled this revision from "[TSAN] add RISCV support" to "[TSAN] add support for riscv64".
alexfanqi edited the summary of this revision.
alexfanqi added reviewers: MaskRay, dvyukov, asb, StephenFan.
alexfanqi published this revision for review.
Herald added subscribers: Sanitizers, cfe-commits, pcwang-thead, eopXD.
Herald added projects: clang, Sanitizers.

fix tsan_rtl_riscv64.S and test failures

remaining test failure:
ThreadSanitizer-riscv64 :: custom_mutex5.cpp                                   
The debuginfo line reported is slightly off. 
custom_mutex5.cpp:14 -> 15
custom_mutex5.cpp:22 -> 23

ThreadSanitizer-riscv64 :: mmap_lots.cpp
flaky, the last 1000 sized mmap can get allocated to 0x0000-0x1000


Implements for sv39 and sv48 VMA layout.

Userspace only has access to the bottom half of vma range. The top half is used by kernel.
There is no dedicated vsyscall or heap segment.
PIE program is allocated to start at TASK_SIZE/3*2. Maximum ASLR is ARCH_MMAP_RND_BITS_MAX+PAGE_SHIFT=24+12=36
Loader, vdso and other libraries are allocated below stack from the top.

Both riscv32 and riscv64 need libatomic for 1,2 bytes atomic ops.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145214

Files:
  clang/lib/Driver/ToolChains/Linux.cpp
  compiler-rt/CMakeLists.txt
  compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
  compiler-rt/lib/tsan/rtl/CMakeLists.txt
  compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
  compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp
  compiler-rt/lib/tsan/rtl/tsan_platform.h
  compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
  compiler-rt/lib/tsan/rtl/tsan_rtl.h
  compiler-rt/lib/tsan/rtl/tsan_rtl_riscv64.S
  compiler-rt/lib/tsan/tests/CMakeLists.txt
  compiler-rt/test/tsan/map32bit.cpp
  compiler-rt/test/tsan/mmap_large.cpp
  compiler-rt/test/tsan/test.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145214.502351.patch
Type: text/x-patch
Size: 16572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230304/37065894/attachment-0001.bin>


More information about the cfe-commits mailing list