[PATCH] D40679: [sanitizer] Introduce a vDSO aware time function, and use it in the allocator [redo]

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 14:38:35 PST 2017


cryptoad created this revision.
Herald added subscribers: kubamracek, srhines.

Redo of https://reviews.llvm.org/D40657, which had the initial discussion. The initial code had to move
into a libcdep file, and things had to be shuffled accordingly.

`NanoTime` is a time sink when checking whether or not to release memory to
the OS. While reducing the amount of calls to said function is in the works,
another solution that was found to be beneficial was to use a timing function
that can leverage the vDSO.

We hit a couple of snags along the way, like the fact that the glibc crashes
when clock_gettime is called from a preinit_array, or the fact that
`__vdso_clock_gettime` is mangled (for security purposes) and can't be used
directly, and also that clock_gettime can be intercepted.

The proposed solution takes care of all this as far as I can tell, and
significantly improve performances and some Scudo load tests with memory
reclaiming enabled.

@mcgrathr: please feel free to follow up on
https://reviews.llvm.org/D40657#940857 here. I posted a reply at
https://reviews.llvm.org/D40657#940974.


https://reviews.llvm.org/D40679

Files:
  lib/sanitizer_common/sanitizer_allocator_primary64.h
  lib/sanitizer_common/sanitizer_common.h
  lib/sanitizer_common/sanitizer_common_interceptors.inc
  lib/sanitizer_common/sanitizer_fuchsia.cc
  lib/sanitizer_common/sanitizer_linux.cc
  lib/sanitizer_common/sanitizer_linux.h
  lib/sanitizer_common/sanitizer_linux_libcdep.cc
  lib/sanitizer_common/sanitizer_win.cc
  lib/scudo/scudo_tsd.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40679.125028.patch
Type: text/x-patch
Size: 6208 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171130/a7c6d7fb/attachment.bin>


More information about the llvm-commits mailing list