Skip to content

Commit e9dd6b2

Browse files
authored
[Asan] Teach FunctionStackPoisoner to filter out struct type with scalable vector type. (#93406)
FunctionStackPoisoner does not serve for `AllocaInst` with scalable vector type, but it does not filter out struct type with scalable vector introduced by c8eb535.
1 parent acfc79d commit e9dd6b2

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -1139,8 +1139,10 @@ struct FunctionStackPoisoner : public InstVisitor<FunctionStackPoisoner> {
11391139
/// Collect Alloca instructions we want (and can) handle.
11401140
void visitAllocaInst(AllocaInst &AI) {
11411141
// FIXME: Handle scalable vectors instead of ignoring them.
1142-
if (!ASan.isInterestingAlloca(AI) ||
1143-
isa<ScalableVectorType>(AI.getAllocatedType())) {
1142+
const Type *AllocaType = AI.getAllocatedType();
1143+
const auto *STy = dyn_cast<StructType>(AllocaType);
1144+
if (!ASan.isInterestingAlloca(AI) || isa<ScalableVectorType>(AllocaType) ||
1145+
(STy && STy->containsHomogeneousScalableVectorTypes())) {
11441146
if (AI.isStaticAlloca()) {
11451147
// Skip over allocas that are present *before* the first instrumented
11461148
// alloca, we don't want to move those around.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
; RUN: opt -passes=asan -disable-output -S %s
2+
; Check not crash.
3+
4+
define void @test() #0 {
5+
entry:
6+
%t0 = alloca { <vscale x 2 x i32>, <vscale x 2 x i32> }, align 4
7+
call void null(ptr null, ptr %t0, i64 0)
8+
ret void
9+
}
10+
11+
attributes #0 = { sanitize_address }

0 commit comments

Comments
 (0)