Skip to content

[MTE] Allow stack history for API level >=35 #110328

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
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
5 changes: 2 additions & 3 deletions llvm/lib/Target/AArch64/AArch64StackTagging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,11 @@ Instruction *AArch64StackTagging::insertBaseTaggedPointer(
IRB.CreateCall(IRG_SP, {Constant::getNullValue(IRB.getInt64Ty())});
Base->setName("basetag");
auto TargetTriple = Triple(M.getTargetTriple());
// This is not a stable ABI for now, so only allow in dev builds with API
// level 10000.
// This ABI will make it into Android API level 35.
// The ThreadLong format is the same as with HWASan, but the entries for
// stack MTE take two slots (16 bytes).
if (ClRecordStackHistory == instr && TargetTriple.isAndroid() &&
TargetTriple.isAArch64() && !TargetTriple.isAndroidVersionLT(10000) &&
TargetTriple.isAArch64() && !TargetTriple.isAndroidVersionLT(35) &&
!AllocasToInstrument.empty()) {
constexpr int StackMteSlot = -3;
constexpr uint64_t TagMask = 0xFULL << 56;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

source_filename = "test.ll"
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-android10000"
target triple = "aarch64--linux-android35"

declare void @g(ptr, ptr, ptr, ptr, ptr, ptr)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
; RUN: opt --try-experimental-debuginfo-iterators -aarch64-stack-tagging -stack-tagging-record-stack-history=instr -S -o - %s | FileCheck %s

target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-android10000"
target triple = "aarch64--linux-android35"

declare void @g(ptr, ptr, ptr, ptr, ptr, ptr)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; RUN: opt -aarch64-stack-tagging -stack-tagging-record-stack-history=instr -S -o - %s | FileCheck %s

target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-linux-android10000"
target triple = "aarch64-unknown-linux-android35"

define dso_local void @f() sanitize_memtag !dbg !14 {
%a1 = alloca i128, align 4
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AArch64/stack-tagging-prologue.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-android10000"
target triple = "aarch64--linux-android35"

declare void @use32(ptr)

Expand Down
Loading