Skip to content

[Asan] Teach FunctionStackPoisoner to filter out struct type with scalable vector type. #93406

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

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1139,8 +1139,10 @@ struct FunctionStackPoisoner : public InstVisitor<FunctionStackPoisoner> {
/// Collect Alloca instructions we want (and can) handle.
void visitAllocaInst(AllocaInst &AI) {
// FIXME: Handle scalable vectors instead of ignoring them.
if (!ASan.isInterestingAlloca(AI) ||
isa<ScalableVectorType>(AI.getAllocatedType())) {
const Type *AllocaType = AI.getAllocatedType();
const auto *STy = dyn_cast<StructType>(AllocaType);
if (!ASan.isInterestingAlloca(AI) || isa<ScalableVectorType>(AllocaType) ||
(STy && STy->containsHomogeneousScalableVectorTypes())) {
if (AI.isStaticAlloca()) {
// Skip over allocas that are present *before* the first instrumented
// alloca, we don't want to move those around.
Expand Down
11 changes: 11 additions & 0 deletions llvm/test/Instrumentation/AddressSanitizer/asan-struct-scalable.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
; RUN: opt -passes=asan -disable-output -S %s
; Check not crash.

define void @test() #0 {
entry:
%t0 = alloca { <vscale x 2 x i32>, <vscale x 2 x i32> }, align 4
call void null(ptr null, ptr %t0, i64 0)
ret void
}

attributes #0 = { sanitize_address }
Loading