[compiler-rt] r312046 - Enable GetRandom for Fuchsia sanitizer.
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 29 14:52:56 PDT 2017
Author: cryptoad
Date: Tue Aug 29 14:52:56 2017
New Revision: 312046
URL: http://llvm.org/viewvc/llvm-project?rev=312046&view=rev
Log:
Enable GetRandom for Fuchsia sanitizer.
Summary: Adds a true implementation of GetRandom, to be used by scudo_utils.h.
Reviewers: mcgrathr, phosek, kcc, vitalybuka, cryptoad
Reviewed By: mcgrathr
Subscribers: kubamracek
Differential Revision: https://reviews.llvm.org/D37218
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc?rev=312046&r1=312045&r2=312046&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc Tue Aug 29 14:52:56 2017
@@ -480,6 +480,14 @@ uptr ReadLongProcessName(/*out*/ char *b
uptr MainThreadStackBase, MainThreadStackSize;
+bool GetRandom(void *buffer, uptr length, bool blocking) {
+ CHECK_LE(length, MX_CPRNG_DRAW_MAX_LEN);
+ size_t size;
+ CHECK_EQ(_mx_cprng_draw(buffer, length, &size), MX_OK);
+ CHECK_EQ(size, length);
+ return true;
+}
+
} // namespace __sanitizer
using namespace __sanitizer; // NOLINT
More information about the llvm-commits
mailing list