[llvm-bugs] [Bug 42868] New: ASAN allocator may return blocks without right red zone

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 1 18:56:29 PDT 2019


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: unassignedbugs at nondot.org
          Reporter: vitalybuka at google.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190802/3d3e2ee4/attachment.html>


More information about the llvm-bugs mailing list