diff options
author | David Carlier <devnexen@gmail.com> | 2019-08-19 18:12:15 +0000 |
---|---|---|
committer | David Carlier <devnexen@gmail.com> | 2019-08-19 18:12:15 +0000 |
commit | 949f1908102ee6ae66e439909ded0fe6e8c5d695 (patch) | |
tree | 8143ddacac06b6a7ab3f825bafdd7e81420b9ce0 | |
parent | f04d246d7d13868e2d0922b9743d0b3f4c76c515 (diff) | |
download | bcm5719-llvm-949f1908102ee6ae66e439909ded0fe6e8c5d695.tar.gz bcm5719-llvm-949f1908102ee6ae66e439909ded0fe6e8c5d695.zip |
[Sanitizer] arc4random interception on Mac
Reviewers: yln,vitalybuka
Reviewed By: yln
Differential Revision: https://reviews.llvm.org/D66391
llvm-svn: 369285
3 files changed, 4 insertions, 3 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp index a944f528f26..8e59b2691c5 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp @@ -13,6 +13,7 @@ #include "sanitizer_platform.h" #if SANITIZER_MAC #include "sanitizer_mac.h" +#include "interception/interception.h" // Use 64-bit inodes in file operations. ASan does not support OS X 10.5, so // the clients will most certainly use 64-bit ones as well. @@ -1181,7 +1182,7 @@ bool GetRandom(void *buffer, uptr length, bool blocking) { if (!buffer || !length || length > 256) return false; // arc4random never fails. - arc4random_buf(buffer, length); + REAL(arc4random_buf)(buffer, length); return true; } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h index e7becbb0e20..7be90ead1a3 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h @@ -561,7 +561,7 @@ #define SANITIZER_INTERCEPT_FUNOPEN (SI_NETBSD || SI_FREEBSD) #define SANITIZER_INTERCEPT_FUNOPEN2 SI_NETBSD #define SANITIZER_INTERCEPT_GETFSENT (SI_FREEBSD || SI_NETBSD || SI_MAC) -#define SANITIZER_INTERCEPT_ARC4RANDOM (SI_FREEBSD || SI_NETBSD) +#define SANITIZER_INTERCEPT_ARC4RANDOM (SI_FREEBSD || SI_NETBSD || SI_MAC) #define SANITIZER_INTERCEPT_FDEVNAME SI_FREEBSD #define SANITIZER_INTERCEPT_GETUSERSHELL (SI_POSIX && !SI_ANDROID) #define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD) diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cpp index 0a983b58f59..826f61a762c 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cpp @@ -1,6 +1,6 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s // -// UNSUPPORTED: linux, darwin, solaris +// UNSUPPORTED: linux, solaris #include <cstdlib> #include <ctime> |