[PATCH] [sanitizer] Syscall hooks

Alexander Potapenko glider at google.com
Thu Apr 11 06:25:37 PDT 2013



================
Comment at: lib/sanitizer_common/sanitizer_common_syscalls.inc:67
@@ +66,3 @@
+
+struct sanitizer_kernel_dirent {
+  long d_ino;
----------------
Pls delete this.

================
Comment at: lib/sanitizer_common/sanitizer_common_syscalls.inc:59
@@ +58,3 @@
+
+struct sanitizer_kernel_dirent64 {
+  unsigned long long d_ino;
----------------
Pls delete this.

================
Comment at: lib/sanitizer_common/sanitizer_common_syscalls.inc:31
@@ +30,3 @@
+#define PRE_SYSCALL(name) SANITIZER_INTERFACE_ATTRIBUTE \
+  void __sanitizer_syscall_pre_##name
+#define PRE_READ(p, s) COMMON_SYSCALL_PRE_READ_RANGE(p, s)
----------------
4-spaces indentation.

================
Comment at: lib/msan/lit_tests/Linux/syscalls.cc:11
@@ +10,3 @@
+#include <sanitizer/msan_interface.h>
+#include <sanitizer/linux_syscalls.h>
+
----------------
Mind the order of includes.

================
Comment at: include/sanitizer/linux_syscalls.h:1
@@ +1,2 @@
+//===-- linux_syscalls.h ---------------------------------------------------===//
+//
----------------
"linux_syscalls.h" is a lame name for a file that doesn't contain any syscalls.
"linux_syscall_hooks", maybe?

================
Comment at: include/sanitizer/linux_syscalls.h:21
@@ +20,3 @@
+
+void __sanitizer_syscall_pre_rt_sigpending(void *p, size_t s);
+void __sanitizer_syscall_pre_getdents(int fd, void *dirp, int count);
----------------
Perhaps the pre and post declarations can be generated using a single macro?
That's more readable and less error-prone.


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



More information about the llvm-commits mailing list