https://bugs.llvm.org/show_bug.cgi?id=42868

            Bug ID: 42868
           Summary: ASAN allocator may return blocks without right red
                    zone
           Product: compiler-rt
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: asan
          Assignee: unassignedb...@nondot.org
          Reporter: vitalyb...@google.com
                CC: llvm-bugs@lists.llvm.org

This regressed at r279572 and still broken on r367246

Usually next page is not mapped and so program may crash on SEGV instead of
nice ASAN report.

clang++ -w test.cc -O1 -fsanitize=address -o  /tmp/test
/tmp/test
test: test.cc:13: int main(): Assertion `__asan_address_is_poisoned(p + s)'
failed.



#include <vector>
#include <cassert>
#include <stdlib.h>

extern "C" int __asan_address_is_poisoned(void const volatile *addr);

int main() {
  std::vector<char*> allocs;
  for (int i = 0; i < 100000; ++i) {
    int s = 128;
    char *p = (char *)malloc(s);
    allocs.push_back(p);
    assert(__asan_address_is_poisoned(p + s));
  }

  assert(!allocs.empty());
  for (auto p : allocs)
    free(p);

}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to