[PATCH] D56465: hwasan: Ignore loads and stores of size 0.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 8 16:48:02 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350683: hwasan: Ignore loads and stores of size 0. (authored by pcc, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D56465?vs=180768&id=180770#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56465/new/
https://reviews.llvm.org/D56465
Files:
compiler-rt/trunk/lib/hwasan/hwasan_checks.h
compiler-rt/trunk/test/hwasan/TestCases/mem-intrinsics-zero-size.c
Index: compiler-rt/trunk/test/hwasan/TestCases/mem-intrinsics-zero-size.c
===================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/mem-intrinsics-zero-size.c
+++ compiler-rt/trunk/test/hwasan/TestCases/mem-intrinsics-zero-size.c
@@ -0,0 +1,10 @@
+// RUN: %clang_hwasan %s -o %t && %run %t
+
+#include <string.h>
+
+int main() {
+ char a[1];
+ memset(a, 0, 0);
+ memmove(a, a, 0);
+ memcpy(a, a, 0);
+}
Index: compiler-rt/trunk/lib/hwasan/hwasan_checks.h
===================================================================
--- compiler-rt/trunk/lib/hwasan/hwasan_checks.h
+++ compiler-rt/trunk/lib/hwasan/hwasan_checks.h
@@ -61,7 +61,8 @@
template <ErrorAction EA, AccessType AT>
__attribute__((always_inline, nodebug)) static void CheckAddressSized(uptr p,
uptr sz) {
- CHECK_NE(0, sz);
+ if (sz == 0)
+ return;
tag_t ptr_tag = GetTagFromPointer(p);
uptr ptr_raw = p & ~kAddressTagMask;
tag_t *shadow_first = (tag_t *)MemToShadow(ptr_raw);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56465.180770.patch
Type: text/x-patch
Size: 1086 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190109/2fad8633/attachment.bin>
More information about the llvm-commits
mailing list