[llvm] [WIP][SPARC] Allow overaligned `alloca`s (PR #107223)

Rainer Orth via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 04:50:47 PDT 2024


rorth wrote:

I've made some progess on the 32-bit Solaris/sparc side:
```
Failed Tests (36):
  AddressSanitizer-Unit :: ./Asan-sparc-calls-Dynamic-Test/65/93
  AddressSanitizer-Unit :: ./Asan-sparc-calls-Test/65/93
  AddressSanitizer-Unit :: ./Asan-sparc-inline-Dynamic-Test/65/93
  AddressSanitizer-Unit :: ./Asan-sparc-inline-Test/65/93
  AddressSanitizer-sparc-sunos :: TestCases/Posix/stack-overflow.cpp
  AddressSanitizer-sparc-sunos :: TestCases/alloca_big_alignment.cpp
  AddressSanitizer-sparc-sunos :: TestCases/alloca_detect_custom_size_.cpp
  AddressSanitizer-sparc-sunos :: TestCases/alloca_loop_unpoisoning.cpp
  AddressSanitizer-sparc-sunos :: TestCases/alloca_overflow_partial.cpp
  AddressSanitizer-sparc-sunos :: TestCases/alloca_overflow_right.cpp
  AddressSanitizer-sparc-sunos :: TestCases/alloca_safe_access.cpp
  AddressSanitizer-sparc-sunos :: TestCases/alloca_underflow_left.cpp
  AddressSanitizer-sparc-sunos :: TestCases/alloca_vla_interact.cpp
  AddressSanitizer-sparc-sunos :: TestCases/global-overflow.cpp
  AddressSanitizer-sparc-sunos :: TestCases/large_func_test.cpp
  AddressSanitizer-sparc-sunos :: TestCases/vla_chrome_testcase.cpp
  AddressSanitizer-sparc-sunos :: TestCases/vla_condition_overflow.cpp
  AddressSanitizer-sparc-sunos :: TestCases/vla_loop_overfow.cpp
  AddressSanitizer-sparc-sunos :: TestCases/zero_page_pc.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/Posix/stack-overflow.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/alloca_big_alignment.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/alloca_detect_custom_size_.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/alloca_loop_unpoisoning.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/alloca_overflow_partial.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/alloca_overflow_right.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/alloca_safe_access.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/alloca_underflow_left.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/alloca_vla_interact.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/global-overflow.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/large_func_test.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/vla_chrome_testcase.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/vla_condition_overflow.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/vla_loop_overfow.cpp
  AddressSanitizer-sparc-sunos-dynamic :: TestCases/zero_page_pc.cpp
  SanitizerCommon-asan-sparc-SunOS :: sanitizer_coverage_trace_pc_guard-dso.cpp
  SanitizerCommon-asan-sparc-SunOS :: sanitizer_coverage_trace_pc_guard.cpp

```
Some of the failures are generic issues with the testcases (e.g. performing unaligned accesses on a strict-alignment target), others might be an endianess issue, but a considerable part of the failures may be related to an issue with your patch, e.g.
`AddressSanitizer-sparc-sunos :: TestCases/alloca_big_alignment.cpp` which, like quite a number of others, `FAIL`s like
```
Assertion failed: !(reinterpret_cast<uintptr_t>(str) & 127L), file /vol/llvm/src/llvm-project/local/compiler-rt/test/asan/TestCases/alloca_big_alignment.cpp, line 10
```
ISTM that your patch doesn't yet heed `__attribute__((aligned(128)))`.

The Linux/sparc64 side of things is considerably worse, unfortunately: quite a number of ASan tests just hang, and while the unittests do work, several 64-bit tests `SEGV`.  Getting this to work will probably take quite a debugging effort.  I guess I'll concentrate on the Solaris side, at least initially.

https://github.com/llvm/llvm-project/pull/107223


More information about the llvm-commits mailing list