[PATCH] D27061: [asan] Avoid duplicate and redundant poisoning checks in __sanitizer_contiguous_container_find_bad_address
Ivan Baravy via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 23 11:02:16 PST 2016
i.baravy created this revision.
i.baravy added reviewers: kcc, eugenis.
i.baravy added subscribers: m.ostapenko, llvm-commits.
i.baravy set the repository for this revision to rL LLVM.
i.baravy added a project: Sanitizers.
Herald added a subscriber: kubabrecka.
//__sanitizer_contiguous_container_find_bad_address// computes three regions of a container to check for poisoning: begin, middle, end. The issue is that in current design these regions can overlap and be significantly larger than //kMaxRangeToCheck//.
Proposed patch fixes the issue by proper calculation of the regions.
Repository:
rL LLVM
https://reviews.llvm.org/D27061
Files:
lib/asan/asan_poisoning.cc
Index: lib/asan/asan_poisoning.cc
===================================================================
--- lib/asan/asan_poisoning.cc
+++ lib/asan/asan_poisoning.cc
@@ -412,10 +412,10 @@
// ending with end.
uptr kMaxRangeToCheck = 32;
uptr r1_beg = beg;
- uptr r1_end = Min(end + kMaxRangeToCheck, mid);
- uptr r2_beg = Max(beg, mid - kMaxRangeToCheck);
- uptr r2_end = Min(end, mid + kMaxRangeToCheck);
- uptr r3_beg = Max(end - kMaxRangeToCheck, mid);
+ uptr r1_end = Min(beg + kMaxRangeToCheck, mid);
+ uptr r2_beg = Max(r1_end, mid - kMaxRangeToCheck/2);
+ uptr r2_end = Min(end, mid + kMaxRangeToCheck/2);
+ uptr r3_beg = Max(r2_end, end - kMaxRangeToCheck);
uptr r3_end = end;
for (uptr i = r1_beg; i < r1_end; i++)
if (AddressIsPoisoned(i))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27061.79111.patch
Type: text/x-patch
Size: 775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161123/8181c831/attachment.bin>
More information about the llvm-commits
mailing list