[compiler-rt] r193670 - [asan] Fix syscall hooks build on Android.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Tue Oct 29 17:58:18 PDT 2013


Author: eugenis
Date: Tue Oct 29 19:58:17 2013
New Revision: 193670

URL: http://llvm.org/viewvc/llvm-project?rev=193670&view=rev
Log:
[asan] Fix syscall hooks build on Android.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_syscalls.inc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_linux.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_syscalls.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_syscalls.inc?rev=193670&r1=193669&r2=193670&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_syscalls.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_syscalls.inc Tue Oct 29 19:58:17 2013
@@ -2063,6 +2063,13 @@ POST_SYSCALL(shmdt)(long res, void *shma
   }
 }
 
+PRE_SYSCALL(ipc)(long call, long first, long second, long third, void *ptr,
+                 long fifth) {}
+
+POST_SYSCALL(ipc)(long res, long call, long first, long second, long third,
+                  void *ptr, long fifth) {}
+
+#if !SANITIZER_ANDROID
 PRE_SYSCALL(shmctl)(long shmid, long cmd, void *buf) {}
 
 POST_SYSCALL(shmctl)(long res, long shmid, long cmd, void *buf) {
@@ -2071,13 +2078,6 @@ POST_SYSCALL(shmctl)(long res, long shmi
   }
 }
 
-PRE_SYSCALL(ipc)(long call, long first, long second, long third, void *ptr,
-                 long fifth) {}
-
-POST_SYSCALL(ipc)(long res, long call, long first, long second, long third,
-                  void *ptr, long fifth) {}
-
-#if !SANITIZER_ANDROID
 PRE_SYSCALL(mq_open)(const void *name, long oflag, long mode, void *attr) {
   if (name)
     PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
@@ -2219,6 +2219,7 @@ PRE_SYSCALL(ni_syscall)() {}
 POST_SYSCALL(ni_syscall)(long res) {}
 
 PRE_SYSCALL(ptrace)(long request, long pid, long addr, long data) {
+#if defined(__i386) || defined (__x86_64)
   if (data) {
     if (request == ptrace_setregs) {
       PRE_READ((void *)data, struct_user_regs_struct_sz);
@@ -2233,9 +2234,11 @@ PRE_SYSCALL(ptrace)(long request, long p
       PRE_READ(iov->iov_base, iov->iov_len);
     }
   }
+#endif
 }
 
 POST_SYSCALL(ptrace)(long res, long request, long pid, long addr, long data) {
+#if defined(__i386) || defined (__x86_64)
   if (res >= 0 && data) {
     // Note that this is different from the interceptor in
     // sanitizer_common_interceptors.inc.
@@ -2256,6 +2259,7 @@ POST_SYSCALL(ptrace)(long res, long requ
       POST_WRITE((void *)data, sizeof(void *));
     }
   }
+#endif
 }
 
 PRE_SYSCALL(add_key)(const void *_type, const void *_description,

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_linux.cc?rev=193670&r1=193669&r2=193670&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_linux.cc Tue Oct 29 19:58:17 2013
@@ -23,6 +23,12 @@
 #include <asm/stat.h>
 #include <linux/aio_abi.h>
 
+#if SANITIZER_ANDROID
+#include <asm/statfs.h>
+#else
+#include <sys/statfs.h>
+#endif
+
 #if !SANITIZER_ANDROID
 #include <linux/perf_event.h>
 #endif
@@ -32,6 +38,7 @@ namespace __sanitizer {
   unsigned struct_kernel_stat_sz = sizeof(struct stat);
   unsigned struct_io_event_sz = sizeof(struct io_event);
   unsigned struct_iocb_sz = sizeof(struct iocb);
+  unsigned struct_statfs64_sz = sizeof(struct statfs64);
 
 #ifndef _LP64
   unsigned struct_kernel_stat64_sz = sizeof(struct stat64);

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc?rev=193670&r1=193669&r2=193670&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc Tue Oct 29 19:58:17 2013
@@ -143,9 +143,12 @@ namespace __sanitizer {
   unsigned struct_sched_param_sz = sizeof(struct sched_param);
   unsigned struct_statfs_sz = sizeof(struct statfs);
 
+#if SANITIZER_MAC
+  unsigned struct_statfs64_sz = sizeof(struct statfs64);
+#endif
+
 #if !SANITIZER_ANDROID
   unsigned ucontext_t_sz = sizeof(ucontext_t);
-  unsigned struct_statfs64_sz = sizeof(struct statfs64);
 #endif // !SANITIZER_ANDROID
 
 #if SANITIZER_LINUX

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h?rev=193670&r1=193669&r2=193670&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h Tue Oct 29 19:58:17 2013
@@ -39,10 +39,10 @@ namespace __sanitizer {
   extern unsigned struct_sigevent_sz;
   extern unsigned struct_sched_param_sz;
   extern unsigned struct_statfs_sz;
+  extern unsigned struct_statfs64_sz;
 
 #if !SANITIZER_ANDROID
   extern unsigned ucontext_t_sz;
-  extern unsigned struct_statfs64_sz;
 #endif // !SANITIZER_ANDROID
 
 #if SANITIZER_LINUX





More information about the llvm-commits mailing list