[PATCH] A patch for sanitizers' syscalls on FreeBSD

Alexey Samsonov samsonov at google.com
Thu Mar 6 01:36:13 PST 2014



================
Comment at: lib/sanitizer_common/sanitizer_platform.h:99
@@ -98,3 +98,3 @@
 #ifndef SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-# ifdef __aarch64__
+# if defined(__aarch64__) && !SANITIZER_FREEBSD
 # define SANITIZER_USES_CANONICAL_LINUX_SYSCALLS 1
----------------
Why not defined(__aarch64__) && SANITIZER_LINUX?
That would correspond to the comment.

================
Comment at: lib/sanitizer_common/sanitizer_syscall_generic.inc:14
@@ -13,2 +13,3 @@
 
-#define internal_syscall syscall
+#if SANITIZER_FREEBSD
+# define SYSCALL(name) SYS_ ## name
----------------
Please provide a #define for internal_syscall in one block, and #define for SYSCALL(name) in another one.

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:719
@@ -664,3 +718,3 @@
 
-#if defined(__x86_64__)
+#if defined(__x86_64__) && !SANITIZER_FREEBSD
 // We cannot use glibc's clone wrapper, because it messes with the child
----------------
Shouldn't we write ... && SANITIZER_LINUX here?

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:781
@@ -726,3 +780,3 @@
 }
 #endif  // defined(__x86_64__)
 
----------------
fix comment

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:477
@@ -434,2 +476,3 @@
 
+#if !SANITIZER_FREEBSD
 uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
----------------
I think it makes more sense to write "#if SANITIZER_LINUX" here and below for linux-specific syscalls (prctl, sigdelset, sigaction_norestorer).

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:81
@@ -70,3 +80,3 @@
 #if defined(__x86_64__) || SANITIZER_WORDSIZE == 64
 # define SANITIZER_LINUX_USES_64BIT_SYSCALLS 1
 #else
----------------
Shouldn't you explicitly #define SANITIZER_LINUX_USES_64BIT_SYSCALLS to 0 on FreeBSD?

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:68
@@ -57,3 +67,3 @@
 // <linux/time.h>
 struct kernel_timeval {
   long tv_sec;
----------------
structs from <linux/....h> headers may instead be guarded with #if SANITIZER_LINUX

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:32
@@ +31,3 @@
+#else
+#include <errno.h>
+#include <sys/types.h>
----------------
errno.h is included below, so is <sys/types.h>


http://llvm-reviews.chandlerc.com/D2900



More information about the llvm-commits mailing list