[PATCH] D149252: [hwasan] fix false positive when hwasan-match-all-tag flag is enabled and short granules are used
Mingjie Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 27 19:05:25 PDT 2023
Enna1 updated this revision to Diff 517771.
Enna1 added a comment.
update
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149252/new/
https://reviews.llvm.org/D149252
Files:
compiler-rt/test/hwasan/TestCases/short-granule-and-match-all-tag.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/test/CodeGen/AArch64/hwasan-check-memaccess.ll
Index: llvm/test/CodeGen/AArch64/hwasan-check-memaccess.ll
===================================================================
--- llvm/test/CodeGen/AArch64/hwasan-check-memaccess.ll
+++ llvm/test/CodeGen/AArch64/hwasan-check-memaccess.ll
@@ -104,8 +104,8 @@
; CHECK-NEXT: .Ltmp6:
; CHECK-NEXT: ret
; CHECK-NEXT: .Ltmp5:
-; CHECK-NEXT: lsr x16, x1, #56
-; CHECK-NEXT: cmp x16, #255
+; CHECK-NEXT: lsr x17, x1, #56
+; CHECK-NEXT: cmp x17, #255
; CHECK-NEXT: b.eq .Ltmp6
; CHECK-NEXT: stp x0, x1, [sp, #-256]!
; CHECK-NEXT: stp x29, x30, [sp, #232]
@@ -121,8 +121,8 @@
; CHECK-NEXT: .Ltmp8:
; CHECK-NEXT: ret
; CHECK-NEXT: .Ltmp7:
-; CHECK-NEXT: lsr x16, x1, #56
-; CHECK-NEXT: cmp x16, #0
+; CHECK-NEXT: lsr x17, x1, #56
+; CHECK-NEXT: cmp x17, #0
; CHECK-NEXT: b.eq .Ltmp8
; CHECK-NEXT: cmp w16, #15
; CHECK-NEXT: b.hi .Ltmp9
Index: llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -531,14 +531,14 @@
if (HasMatchAllTag) {
OutStreamer->emitInstruction(MCInstBuilder(AArch64::UBFMXri)
- .addReg(AArch64::X16)
+ .addReg(AArch64::X17)
.addReg(Reg)
.addImm(56)
.addImm(63),
*STI);
OutStreamer->emitInstruction(MCInstBuilder(AArch64::SUBSXri)
.addReg(AArch64::XZR)
- .addReg(AArch64::X16)
+ .addReg(AArch64::X17)
.addImm(MatchAllTag)
.addImm(0),
*STI);
Index: compiler-rt/test/hwasan/TestCases/short-granule-and-match-all-tag.cpp
===================================================================
--- /dev/null
+++ compiler-rt/test/hwasan/TestCases/short-granule-and-match-all-tag.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_hwasan -mllvm -hwasan-match-all-tag=0 %s -o %t && %run %t
+
+#include <sanitizer/hwasan_interface.h>
+#include <stdlib.h>
+
+int main() {
+ __hwasan_enable_allocator_tagging();
+ char *x = (char *)malloc(40);
+ char volatile z = *x;
+ free(x);
+ return 0;
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149252.517771.patch
Type: text/x-patch
Size: 2443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230428/03052eff/attachment.bin>
More information about the llvm-commits
mailing list