[compiler-rt] r369285 - [Sanitizer] arc4random interception on Mac
David Carlier via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 11:12:15 PDT 2019
Author: devnexen
Date: Mon Aug 19 11:12:15 2019
New Revision: 369285
URL: http://llvm.org/viewvc/llvm-project?rev=369285&view=rev
Log:
[Sanitizer] arc4random interception on Mac
Reviewers: yln,vitalybuka
Reviewed By: yln
Differential Revision: https://reviews.llvm.org/D66391
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cpp
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/arc4random.cpp
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cpp?rev=369285&r1=369284&r2=369285&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cpp (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cpp Mon Aug 19 11:12:15 2019
@@ -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
if (!buffer || !length || length > 256)
return false;
// arc4random never fails.
- arc4random_buf(buffer, length);
+ REAL(arc4random_buf)(buffer, length);
return true;
}
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=369285&r1=369284&r2=369285&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Mon Aug 19 11:12:15 2019
@@ -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)
Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/arc4random.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/arc4random.cpp?rev=369285&r1=369284&r2=369285&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/arc4random.cpp (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/arc4random.cpp Mon Aug 19 11:12:15 2019
@@ -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>
More information about the llvm-commits
mailing list