[PATCH] A patch for sanitizers' syscalls on FreeBSD

Viktor Kutuzov vkutuzov at accesssoftek.com
Wed Mar 5 09:34:05 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);
----------------
Alexey Samsonov wrote:
> Can we instead make sure that SANITIZER_USES_CANONICAL_LINUX_SYSCALLS is 0 on FreeBSD?
Sounds reasonable. Will do.

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:263
@@ +262,3 @@
+#if SANITIZER_FREEBSD
+  internal_syscall(SYSCALL(exit), exitcode);
+#else
----------------
Alexey Samsonov wrote:
> Is there no exit_group on FreeBSD?
No, there's no one. We should probably address potential issues in another diff, since there's no trivial solution?

================
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;
----------------
Alexey Samsonov wrote:
> Where do these defs come from on FreeBSD?
##<sys/elf_generic.h>## defines them via macro stuff similar to the Linux one:
  #define __ElfType(x) typedef __ElfN(x) CONCAT(Elf_,x)
  __ElfType(Ehdr); 
  __ElfType(Phdr);


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



More information about the llvm-commits mailing list