[llvm-commits] [PATCH] AddressSanitizer: runtime support for use-after-scope bugs.
Alexey Samsonov
samsonov at google.com
Fri Nov 30 10:49:28 PST 2012
================
Comment at: lib/asan/lit_tests/use-after-scope-inlined.cc:1
@@ +1,2 @@
+// Test with "-O2" only to make sure inlining (leading to use-after-scope)
+// happens. "always_inline" is not enough, as Clang doesn't emit
----------------
Kostya Serebryany wrote:
> use-after-scope feature deserves a more extensive set test,
> probably in form of large list of DEATH_TESTS (like in asan_test.cc)
> in a separate file, asan_lifetime_test.cc
> That could go as a separate commit.
I agree that I should better start writing these tests :) Anyway, they should go in when we teach Clang to emit lifetime markers to catch actual use-after-scope bugs.
================
Comment at: lib/asan/asan_poisoning.cc:167
@@ +166,3 @@
+ s8 end_value = *shadow_end;
+ if (do_poison) {
+ // If possible, mark all the bytes mapping to last shadow byte as
----------------
Kostya Serebryany wrote:
> Can we simplify the logic here?
> E.g. if (do_poison) we can easily poison an extra byte unconditionally.
> if (!do_poison) maybe we can use PoisonShadowPartialRightRedzone?
>
we can't do this for "if (do_poison)": if for some reason the last 8-byte chunk is fully addressable and we want to mark as poisoned only the first few bytes of it - we simply can't do it (as it breaks our shadow invariant) - that's what the if() guards.
for "if (!do_poison) - dunno, PoisonShadowPartialRightRedzone seems to be poorly fitting for unpoisoning case.
http://llvm-reviews.chandlerc.com/D141
More information about the llvm-commits
mailing list