[PATCH] A patch for sanitizers' syscalls on FreeBSD

Alexey Samsonov samsonov at google.com
Tue Mar 4 04:26:15 PST 2014



================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:127
@@ -103,3 +126,3 @@
 uptr internal_open(const char *filename, int flags) {
-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-  return internal_syscall(__NR_openat, AT_FDCWD, (uptr)filename, flags);
+#if !SANITIZER_FREEBSD && SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+  return internal_syscall(SYSCALL(openat), AT_FDCWD, (uptr)filename, flags);
----------------
Can we instead make sure that SANITIZER_USES_CANONICAL_LINUX_SYSCALLS is 0 on FreeBSD?

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:95
@@ -83,1 +94,3 @@
 
+#if SANITIZER_FREEBSD
+# define SYSCALL(name) SYS_ ## name
----------------
We have sanitizer_syscall_*.inc files for that. Probably we should #include sanitizer_syscall_linux_x86_64.inc above only for __x86_64__ and SANITIZER_LINUX and do smth. different for FreeBSD.

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:263
@@ +262,3 @@
+#if SANITIZER_FREEBSD
+  internal_syscall(SYSCALL(exit), exitcode);
+#else
----------------
Is there no exit_group on FreeBSD?

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:640
@@ -576,1 +639,3 @@
+  return sysconf(_SC_PAGESIZE);
+#elif defined(__x86_64__) || defined(__i386__)
   return EXEC_PAGESIZE;
----------------
Just use EXEC_PAGESIZE if (SANITIZER_LINUX && (__x86_64__ || i386))

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:696
@@ -630,2 +695,3 @@
+#if !SANITIZER_FREEBSD
   typedef ElfW(Phdr) Elf_Phdr;
   typedef ElfW(Ehdr) Elf_Ehdr;
----------------
Where do these defs come from on FreeBSD?


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



More information about the llvm-commits mailing list