[PATCH] D139827: [RISCV][Asan] Use dynamic shadow offset to make it work on different width of virtual-memory system.

Kito Cheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 23:06:52 PST 2023


kito-cheng added a comment.

> Supporting too many address space bits can introduce significant hidden maintenance burden and performance implication, e.g. using SizeClassAllocator32 for LeakSanitizer (standalone or asan/hwasan integrated) is extremely slow.
> See D137666 <https://reviews.llvm.org/D137666> that AArch64 msan dropped <48-bit VMA. A line needs to be drawn.

As I know there is still many RISC-V core are implement with Sv39 for now, we might able to drop support in future but it's not good timing for now I think.

---

Will defer few more days to commit for continue the discussion.



================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_platform.h:310
+// this will not work correctly on Sv57.
+#  define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 47)
 #elif defined(__aarch64__)
----------------
shabnam4b wrote:
> Just out of curiosity, why can't we modify the code for SV57 here which I assume works for Sv48 and SV39? Maybe there is no way to test it?
> I ran this patch on Qemu as well as Docker (Qemu user) and it worked.
> The only thing on testing with docker was when the code does not have a bug, it prints the output but it generates a log for a fatal error:
> 
> 
> ```
> root at 74c2d5eadeed:/llvm-project/build# ./nobug
> string is: Hello world!
> ==76543==LeakSanitizer has encountered a fatal error.
> ==76543==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
> ==76543==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
> ```
> Just out of curiosity, why can't we modify the code for SV57 here which I assume works for Sv48 and SV39? Maybe there is no way to test it?

In theory: yes, we can modify it to Sv57 and should work with Sv48 and Sv39, but we have no way to test due to the RISC-V linux didn't support that - and we don't have HW to test that too.

> The only thing on testing with docker was when the code does not have a bug, it prints the output but it generates a log for a fatal error:

The message seems cause by docker.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139827/new/

https://reviews.llvm.org/D139827



More information about the llvm-commits mailing list