-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[ASAN][AArch64] Asan crash fix for scalable types. #155505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Asan doesn't support scalable types yet. Compiler crashes when alloca's size comes from a scalable type.
|
@llvm/pr-subscribers-compiler-rt-sanitizer @llvm/pr-subscribers-llvm-transforms Author: Daniel Kiss (DanielKristofKiss) ChangesAsan doesn't support scalable types yet. Compiler crashes when alloca's size comes from a scalable type. Full diff: https://github.com/llvm/llvm-project/pull/155505.diff 2 Files Affected:
diff --git a/clang/test/CodeGen/asan-scalabe-vector.cpp b/clang/test/CodeGen/asan-scalabe-vector.cpp
new file mode 100644
index 0000000000000..77f46f81f5b70
--- /dev/null
+++ b/clang/test/CodeGen/asan-scalabe-vector.cpp
@@ -0,0 +1,12 @@
+// Regression test for compiler crash
+// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -target-feature +sve -target-feature +sve2 -emit-obj -fsanitize=address -fsanitize-address-use-after-scope %s -o - | llvm-objdump -d - | FileCheck %s
+// REQUIRES: aarch64-registered-target
+
+#include <arm_sve.h>
+int biz(svfloat64_t*);
+int foo(){
+ svfloat64_t a,b,c;
+ return biz(&a)+biz(&b)+biz(&c);
+}
+
+//CHECK: 0000000000000000 <_Z3foov>:
\ No newline at end of file
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 50258af5e26c3..19d6bf56e479c 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1406,6 +1406,8 @@ bool AddressSanitizer::isInterestingAlloca(const AllocaInst &AI) {
(AI.getAllocatedType()->isSized() &&
// alloca() may be called with 0 size, ignore it.
((!AI.isStaticAlloca()) || !getAllocaSizeInBytes(AI).isZero()) &&
+ // alloca() may be called with a scalable parameter, we can't handle it.
+ !AI.getAllocationSize(AI.getDataLayout())->isScalable() &&
// We are only interested in allocas not promotable to registers.
// Promotable allocas are common under -O0.
(!ClSkipPromotableAllocas || !isAllocaPromotable(&AI)) &&
|
|
@llvm/pr-subscribers-clang Author: Daniel Kiss (DanielKristofKiss) ChangesAsan doesn't support scalable types yet. Compiler crashes when alloca's size comes from a scalable type. Full diff: https://github.com/llvm/llvm-project/pull/155505.diff 2 Files Affected:
diff --git a/clang/test/CodeGen/asan-scalabe-vector.cpp b/clang/test/CodeGen/asan-scalabe-vector.cpp
new file mode 100644
index 0000000000000..77f46f81f5b70
--- /dev/null
+++ b/clang/test/CodeGen/asan-scalabe-vector.cpp
@@ -0,0 +1,12 @@
+// Regression test for compiler crash
+// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -target-feature +sve -target-feature +sve2 -emit-obj -fsanitize=address -fsanitize-address-use-after-scope %s -o - | llvm-objdump -d - | FileCheck %s
+// REQUIRES: aarch64-registered-target
+
+#include <arm_sve.h>
+int biz(svfloat64_t*);
+int foo(){
+ svfloat64_t a,b,c;
+ return biz(&a)+biz(&b)+biz(&c);
+}
+
+//CHECK: 0000000000000000 <_Z3foov>:
\ No newline at end of file
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 50258af5e26c3..19d6bf56e479c 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1406,6 +1406,8 @@ bool AddressSanitizer::isInterestingAlloca(const AllocaInst &AI) {
(AI.getAllocatedType()->isSized() &&
// alloca() may be called with 0 size, ignore it.
((!AI.isStaticAlloca()) || !getAllocaSizeInBytes(AI).isZero()) &&
+ // alloca() may be called with a scalable parameter, we can't handle it.
+ !AI.getAllocationSize(AI.getDataLayout())->isScalable() &&
// We are only interested in allocas not promotable to registers.
// Promotable allocas are common under -O0.
(!ClSkipPromotableAllocas || !isAllocaPromotable(&AI)) &&
|
|
recent regression, doesn't present on the 20.x branch but on main |
|
This might overlap with #155357 |
Yep, as it went already in drop this. |
Asan doesn't support scalable types yet. Compiler crashes when alloca's size comes from a scalable type.