This is an archive of the discontinued LLVM Phabricator instance.

[Sanitizers] Move cached allocator_may_return_null flag to sanitizer_allocator
ClosedPublic

Authored by alekseyshl on Jun 16 2017, 5:47 PM.

Details

Summary

Move cached allocator_may_return_null flag to sanitizer_allocator.cc and
provide API to consolidate and unify the behavior of all specific allocators.

Make all sanitizers using CombinedAllocator to follow
AllocatorReturnNullOrDieOnOOM() rules to behave the same way when OOM
happens.

When OOM happens, turn allocator_out_of_memory flag on regardless of
allocator_may_return_null flag value (it used to not to be set when
allocator_may_return_null == true).

release_to_os_interval_ms and rss_limit_exceeded will likely be moved to
sanitizer_allocator.cc too (later).

Diff Detail

Repository
rL LLVM

Event Timeline

alekseyshl created this revision.Jun 16 2017, 5:47 PM
eugenis added inline comments.Jun 16 2017, 5:58 PM
lib/asan/asan_allocator.cc
425 ↗(On Diff #102916)

why?

alekseyshl marked an inline comment as done.Jun 16 2017, 6:04 PM
alekseyshl added inline comments.
lib/asan/asan_allocator.cc
425 ↗(On Diff #102916)

ReturnNullOrDieOnOOM condition is enforced in CombinedAllocator now, so all sanitizers can benefit from it.

alekseyshl marked an inline comment as done.Jun 16 2017, 6:26 PM
alekseyshl added inline comments.
lib/sanitizer_common/sanitizer_allocator.cc
97 ↗(On Diff #102916)

As discussed offline, I'll add a failure handling policy to CombinedAllocator to address internal allocator needs.

  • Define failure handling policy for the allocator.

Added the policy.

eugenis accepted this revision.Jun 19 2017, 3:44 PM

LGTM

This revision is now accepted and ready to land.Jun 19 2017, 3:44 PM
This revision was automatically updated to reflect the committed changes.