[PATCH] [compiler-rt] Fix the prototype of ioctl interceptor

Evgeniy Stepanov eugenis at google.com
Thu Jan 22 02:23:13 PST 2015


In http://reviews.llvm.org/D7038#111635, @kubabrecka wrote:

> Updating sanitizer_common_interceptors_ioctl.inc with `unsigned` -> `unsigned long` as well.
>
> > I agree with "unsigned long request", but is there any benefit in the _unconditional_ va_arg stuff? We don't reliably know if there is an argument to a given ioctl or not, and then we pass this (possible garbage) value to REAL(ioctl) in any case.
>
>
> I don't think we have a way to tell whether that argument is used or not.  The docs (e.g. http://man7.org/linux/man-pages/man2/ioctl.2.html) also suggest that it's always used:


Exactly. Then why go through va_arg()?


================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc:16
@@ -15,3 +15,3 @@
 struct ioctl_desc {
-  unsigned req;
+  unsigned long req;
   // FIXME: support read+write arguments. Currently READWRITE and WRITE do the
----------------
This costs 4 bytes multiplied by the number of known ioctls. We know that all values of req fit in "unsigned" - they are compile-time constants.

http://reviews.llvm.org/D7038

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list