[PATCH] D53413: [Sanitize] openbsd does not have sysctlbyname call

David CARLIER via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 20 22:44:51 PDT 2018


devnexen updated this revision to Diff 170326.

https://reviews.llvm.org/D53413

Files:
  lib/sanitizer_common/sanitizer_linux.cc
  lib/sanitizer_common/sanitizer_openbsd.cc


Index: lib/sanitizer_common/sanitizer_openbsd.cc
===================================================================
--- lib/sanitizer_common/sanitizer_openbsd.cc
+++ lib/sanitizer_common/sanitizer_openbsd.cc
@@ -51,6 +51,13 @@
   return mprotect(addr, length, prot);
 }
 
+int internal_sysctlbyname(const char *sname, void *oldp, uptr *oldlenp,
+                          const void *newp, uptr newlen) {
+  Printf("internal_sysctlbyname not implemented for OpenBSD");
+  Die();
+  return 0;
+}
+
 uptr ReadBinaryName(/*out*/char *buf, uptr buf_len) {
   // On OpenBSD we cannot get the full path
   struct kinfo_proc kp;
Index: lib/sanitizer_common/sanitizer_linux.cc
===================================================================
--- lib/sanitizer_common/sanitizer_linux.cc
+++ lib/sanitizer_common/sanitizer_linux.cc
@@ -796,16 +796,13 @@
 #endif
 }
 
+#if SANITIZER_FREEBSD
 int internal_sysctlbyname(const char *sname, void *oldp, uptr *oldlenp,
                           const void *newp, uptr newlen) {
-#if SANITIZER_OPENBSD
-  return sysctlbyname(sname, oldp, (size_t *)oldlenp, (void *)newp,
-                      (size_t)newlen);
-#else
   return sysctlbyname(sname, oldp, (size_t *)oldlenp, newp, (size_t)newlen);
-#endif
 }
 #endif
+#endif
 
 #if SANITIZER_LINUX
 #define SA_RESTORER 0x04000000


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53413.170326.patch
Type: text/x-patch
Size: 1316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181021/61951be8/attachment.bin>


More information about the llvm-commits mailing list