[PATCH] D55711: Don't trigger sanitizer initialization from `sysctlbyname` interceptor.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 16 11:12:56 PST 2018


delcypher updated this revision to Diff 178403.
delcypher added a comment.

- Also intercept sysctl
- Don't use `UNLIKELY(...)`
- Use `internal_sysctl*` rather than `REAL(sysctl*)`


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55711/new/

https://reviews.llvm.org/D55711

Files:
  lib/sanitizer_common/sanitizer_common_interceptors.inc


Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -7539,6 +7539,9 @@
 INTERCEPTOR(int, sysctl, int *name, unsigned int namelen, void *oldp,
             SIZE_T *oldlenp, void *newp, SIZE_T newlen) {
   void *ctx;
+  if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED) {
+    return internal_sysctl(name, namelen, oldp, oldlenp, newp, newlen);
+  }
   COMMON_INTERCEPTOR_ENTER(ctx, sysctl, name, namelen, oldp, oldlenp, newp,
                            newlen);
   if (name)
@@ -7561,6 +7564,9 @@
 INTERCEPTOR(int, sysctlbyname, char *sname, void *oldp, SIZE_T *oldlenp,
             void *newp, SIZE_T newlen) {
   void *ctx;
+  if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED) {
+    return internal_sysctlbyname(sname, oldp, oldlenp, newp, newlen);
+  }
   COMMON_INTERCEPTOR_ENTER(ctx, sysctlbyname, sname, oldp, oldlenp, newp,
                            newlen);
   if (sname)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55711.178403.patch
Type: text/x-patch
Size: 1077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181216/a7081d05/attachment.bin>


More information about the llvm-commits mailing list