[PATCH] D39624: [Sanitizers] Call NanoTime() conditionally.
Aleksey Shlyapnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 3 16:22:00 PDT 2017
alekseyshl created this revision.
Herald added a subscriber: kubamracek.
Call NanoTime() in primary 64 bit allocator only when necessary,
otherwise the unwarranted syscall causes problems in sandbox environments.
ReleaseToOSIntervalMs() conditional allows them to turn the feature off
with allocator_release_to_os_interval_ms=-1 flag.
https://reviews.llvm.org/D39624
Files:
lib/sanitizer_common/sanitizer_allocator_primary64.h
Index: lib/sanitizer_common/sanitizer_allocator_primary64.h
===================================================================
--- lib/sanitizer_common/sanitizer_allocator_primary64.h
+++ lib/sanitizer_common/sanitizer_allocator_primary64.h
@@ -677,7 +677,10 @@
// preventing just allocated memory from being released sooner than
// necessary and also preventing extraneous ReleaseMemoryPagesToOS calls
// for short lived processes.
- region->rtoi.last_release_at_ns = NanoTime();
+ // Do it only when the feature is turned on, to avoid a potentially
+ // extraneous syscall.
+ if (ReleaseToOSIntervalMs() >= 0)
+ region->rtoi.last_release_at_ns = NanoTime();
}
// Do the mmap for the user memory.
uptr map_size = kUserMapSize;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39624.121564.patch
Type: text/x-patch
Size: 814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171103/fe67de96/attachment.bin>
More information about the llvm-commits
mailing list