[PATCH] A patch for sanitizers' syscalls on FreeBSD

Viktor Kutuzov vkutuzov at accesssoftek.com
Fri Feb 28 03:57:34 PST 2014



================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:168
@@ -135,3 +167,3 @@
 
-#if !SANITIZER_LINUX_USES_64BIT_SYSCALLS
+#if !SANITIZER_LINUX_USES_64BIT_SYSCALLS && !SANITIZER_FREEBSD
 static void stat64_to_stat(struct stat64 *in, struct stat *out) {
----------------
Alexander Potapenko wrote:
> How 'bout setting SANITIZER_LINUX_USES_64BIT_SYSCALLS under FreeBSD?
> We can rename it into SANITIZER_POSIX_USES_64BIT_SYSCALLS or something similar.
I'm not sure I follow. The intention is that we don't define whatever is under this ###if## on FreeBSD--whether on Linux we would use 64-bit syscalls or 32-bit ones. It's more likely that we should not define ##SANITIZER_LINUX_USES_64BIT_SYSCALLS## on FreeBSD at all?

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:440
@@ +439,3 @@
+#if SANITIZER_FREEBSD
+  volatile int *locked = (volatile int*)&opaque_storage_;
+  while (__sync_val_compare_and_swap(locked, 0, 1)) {}
----------------
Alexander Potapenko wrote:
> I wonder why not use the atomic_exchange operation like this is done in the code below?
Umm, I think I should try ##_umtx_op()## to wait for the futex. Thanks!


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



More information about the llvm-commits mailing list