sanitizer: enable getentropy interception on Linux/GLIBC 2.25 and onwards
authorDavid CARLIER <devnexen@gmail.com>
Sun, 25 Jun 2023 15:21:15 +0000 (16:21 +0100)
committerDavid CARLIER <devnexen@gmail.com>
Mon, 26 Jun 2023 07:04:08 +0000 (08:04 +0100)
https://man7.org/linux/man-pages/man3/getentropy.3.html

Reviewers: melver

Reviewed-By: melver
Differential Revision: https://reviews.llvm.org/D153723

compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h

index ec67e25..c740778 100644 (file)
 #define SANITIZER_INTERCEPT___CXA_ATEXIT SI_NETBSD
 #define SANITIZER_INTERCEPT_ATEXIT SI_NETBSD
 #define SANITIZER_INTERCEPT_PTHREAD_ATFORK SI_NETBSD
-#define SANITIZER_INTERCEPT_GETENTROPY SI_FREEBSD
+#define SANITIZER_INTERCEPT_GETENTROPY \
+  ((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD)
 #define SANITIZER_INTERCEPT_QSORT \
   (SI_POSIX && !SI_IOSSIM && !SI_WATCHOS && !SI_TVOS && !SI_ANDROID)
 #define SANITIZER_INTERCEPT_QSORT_R SI_GLIBC