[PATCH] [sanitizer] Implement ioctl decoding.

Evgeniy Stepanov eugenis at google.com
Tue Feb 4 07:37:25 PST 2014


  Are you sure you don't want to do a safe (msan-only) write if the ioctl was decoded rather then looked up?


================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc:546
@@ +545,3 @@
+  }
+  char id = IOC_TYPE(req);
+  // Sanity check.
----------------
Check for size != 0, at least when dir != IOC_NONE.


================
Comment at: lib/sanitizer_common/sanitizer_platform_limits_posix.h:522
@@ +521,3 @@
+#define IOC_TYPEBITS 8
+#define IOC_SIZEBITS 14
+#define IOC_DIRBITS 2
----------------
What about powerpc?

================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc:588
@@ -557,2 +587,3 @@
                               unsigned request, void *arg) {
+Report("POST %d\n", (int)desc->type);
   if (desc->type == ioctl_desc::WRITE || desc->type == ioctl_desc::READWRITE) {
----------------
Please remove.

================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc:496
@@ -495,3 +495,3 @@
 #if SANITIZER_LINUX
   if ((req & ~0x3fff001fU) == IOCTL_EVIOCGBIT)
     return IOCTL_EVIOCGBIT;
----------------
Please rewrite this using new macros.


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



More information about the llvm-commits mailing list