[Mlir-commits] [libcxx] [mlir] [llvm] [compiler-rt] [clang] [asan] Enable StackSafetyAnalysis by default (PR #77210)

Ulrich Weigand llvmlistbot at llvm.org
Fri Jan 19 06:56:22 PST 2024


uweigand wrote:

@MaskRay I've done a bit more analysis now, and what seems to be going on is that with stack safety analysis off, this check:
```
  char array[len];
  assert(!(reinterpret_cast<uintptr_t>(array) & 31L));
```
succeeds because the VLA allocation gets instrumented, and therefore the VLA address is guaranteed to be 32-byte aligned.

However, with stack safety analysis *on*, that analysis (correctly) detects that the VLA is actually never accessed, and therefore the allocation does not need be instrumented.  Because it is isn't instrumented, it remains a regular alloca without special alignment requirements.

Therefore, there is no guarantee that the assert will succeed.  If the incoming stack pointer happened to already be 32-byte aligned, it will succeed - otherwise (and that's the cases where we're seeing failures on s390x), it will not.

This seems to be a platform-independent bug that just happens to be visible only on some platforms sometimes.


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


More information about the Mlir-commits mailing list