[PATCH] D34731: [Sanitizers] Operator new() interceptors always die on allocation error

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 18:07:08 PDT 2017


alekseyshl created this revision.
Herald added a subscriber: kubamracek.

Operator new interceptors behavior is now controlled by their nothrow
property as well as by allocator_may_return_null flag value:

- allocator_may_return_null=* + new()        - die on allocation error
- allocator_may_return_null=0 + new(nothrow) - die on allocation error
- allocator_may_return_null=1 + new(nothrow) - return null

Ideally new() should throw std::bad_alloc exception, but that is not
trivial to achieve, hence TODO.


https://reviews.llvm.org/D34731

Files:
  lib/asan/asan_allocator.cc
  lib/asan/asan_new_delete.cc
  lib/lsan/lsan_interceptors.cc
  lib/msan/msan_new_delete.cc
  lib/scudo/scudo_new_delete.cpp
  lib/tsan/rtl/tsan_new_delete.cc
  test/asan/TestCases/allocator_returns_null.cc
  test/msan/allocator_returns_null.cc
  test/scudo/sizes.cpp
  test/tsan/allocator_returns_null.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34731.104330.patch
Type: text/x-patch
Size: 34255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170628/64510705/attachment.bin>


More information about the llvm-commits mailing list