[PATCH] D40038: [scudo] Soft and hard RSS limit checks

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 09:56:28 PST 2017


cryptoad created this revision.

This implements an opportunistic check for the RSS limit.

For ASan, this was implemented thanks to a background thread checking the
current RSS vs the set limit every 100ms. This was deemed problematic for Scudo
due to potential Android concerns (Zygote as pointed out by Aleksey) as well as
the general inconvenience of having a permanent background thread.

If a limit (soft or hard) is specified, we will attempt to update the RSS limit
status (exceeded or not) every 100ms. This is done in an opportunistic way: if
we can update it, we do it, if not we return the current status, mostly because
we don't need it to be fully consistent (it's done every 100ms anyway). If the
limit is exceeded `allocate` will act as if OOM for a soft limit, or just die
for a hard limit.

We use the `common_flags()`'s `hard_rss_limit_mb` & `soft_rss_limit_mb` for
configuration of the limits.


https://reviews.llvm.org/D40038

Files:
  lib/scudo/scudo_allocator.cpp
  test/scudo/rss.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40038.122866.patch
Type: text/x-patch
Size: 6587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171114/f6668a3e/attachment.bin>


More information about the llvm-commits mailing list