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

Hau Hsu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 22:36:56 PDT 2023


hauhsu added a comment.

Hi all,
I just published 3 more reviews:
https://reviews.llvm.org/D152895
https://reviews.llvm.org/D152990
https://reviews.llvm.org/D152991

With the 3 new patches, the `check-lsan` passes in our sv39, sv48, sv57 QEMU system mode test environments.
The common `check-asan` failure cases in the 3 virtual memory modes are

  AddressSanitizer-riscv64-linux :: TestCases/Linux/syscalls.cpp
  AddressSanitizer-riscv64-linux :: TestCases/Posix/bcmp_test.cpp
  AddressSanitizer-riscv64-linux :: TestCases/memcmp_test.cpp
  AddressSanitizer-riscv64-linux :: TestCases/log-path_test.cpp

The first 3 failures are because the CHECK statements check specific function names in call stack, like

  // CHECK: AddressSanitizer: stack-buffer-overflow  (v)
  // CHECK: {{#1.*bcmp}}                             
  // CHECK: {{#2.*main}}

But the  function `QuickCheckForUnpoisonedRegion()` is not inlined, so the call stack looks like

  #0 0x2aac31a59c in MemcmpInterceptorCommon(void*, int (*)(void const*, void const*, unsigned long), void const*, void const*, unsigned long) .../llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:804:7
  #1 0x2aac31a9aa in QuickCheckForUnpoisonedRegion .../llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:850:10
  #2 0x2aac31a9aa in bcmp .../llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:817:7
  #3 0x2aac3bbca8 in main .../llvm-project/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cpp:13:13
  #4 0x3f886e36c0  (/lib/libc.so.6+0x266c0)
  #5 0x3f886e376c in __libc_start_main (/lib/libc.so.6+0x2676c)
  #6 0x2aac306d52 in _start (.../llvm-project/build/test/asan/RISCV64LinuxConfig/TestCases/Posix/Output/bcmp_test.cpp.tmp+0x26d52)

https://reviews.llvm.org/D152991 looses the check statement to make the tests pass.

For  `AddressSanitizer-riscv64-linux :: TestCases/log-path_test.cpp` failure, one of the test tries to set the log path to `/INVALID` and expects error.
But since in our QEMU test environment uses root, so the path is actually valid.

There are 3 additional check-asan failures for sv57:

  AddressSanitizer-riscv64-linux :: TestCases/Linux/allocator_oom_test.cpp
  AddressSanitizer-riscv64-linux :: TestCases/Linux/auto_memory_profile_test.cpp
  AddressSanitizer-riscv64-linux :: TestCases/Linux/quarantine_size_mb.cpp

We are still investigating them. But since the tests seems not so critical and  sv57 is rather little users, we decide to propose the reviews for now.


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