Depends on D129371.
It survived all GCC ASan tests.
Changes are trivial and mostly "borrowed" RISC-V logics, except that a different SHADOW_OFFSET is used.
Differential D129418
[sanitizer][LoongArch] Port address sanitizer to LoongArch xry111 on Jul 9 2022, 12:22 AM. Authored by
Details Depends on D129371. It survived all GCC ASan tests. Changes are trivial and mostly "borrowed" RISC-V logics, except that a different SHADOW_OFFSET is used.
Diff Detail
Event Timeline
Comment Actions Add @XiaodongLoong who ever ported compiler-rt to LoongArch on LLVM8 in the old world where the VMA is 40-bit. Thanks.
Comment Actions Mark __interceptor::real_vfork with ASM_HIDDEN and use la.local for it. Add %plt for COMMON_INTERCEPTOR_HANDLE_VFORK because it's not DSO local and the linker warns about using calling it w/o PLT. Comment Actions LGTM besides two extremely minor nits.
Comment Actions Could you share some detail about how to build and test llvm's sanitizer with GCC's testcase? Thanks. Previouly in llvm8 we only test it with clang itself.
Comment Actions I've rebased and applied the two diffs for GCC. And for ASan, define TARGET_ASAN_SHADOW_OFFSET to return the shadow offset (1 << 46). The changes are available at https://github.com/xry111/gcc/tree/me/loongarch-sanitizer-test. Build it with /path/to/gcc/configure --prefix=/home/xry111/gcc-trunk --disable-multilib --with-system-zlib --enable-libsanitizer --disable-bootstrap, then make. --enable-libsanitizer is necessary because libsanitizer is not enabled by default by GCC building system for LoongArch target. --disable-bootstrap saves some time, but if the system compiler is affected by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096 you'll need --enable-bootstrap. Run UBSan tests with make check-gcc RUNTESTFLAGS=ubsan.exp. Run ASan tests with make check-gcc RUNTESTFLAGS=asan.exp. Comment Actions LGTM. Thanks. Seems that currently we can only check the changes by GCC because LoongArch hasn’t been supported by clang. Not sure whether this change could land. What do others think?
Comment Actions
+vitalybuka for this question.
Comment Actions I don't have write access to rG, if you think these two changes are OK please commit it. |
The list seems to be alphabetized. Insert it before the riscv64 line?