Index: lib/sanitizer_common/sanitizer_common_interceptors.inc =================================================================== --- lib/sanitizer_common/sanitizer_common_interceptors.inc +++ lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -1025,8 +1025,12 @@ #if SANITIZER_INTERCEPT_IOCTL #include "sanitizer_common_interceptors_ioctl.inc" -INTERCEPTOR(int, ioctl, int d, unsigned request, void *arg) { +INTERCEPTOR(int, ioctl, int d, unsigned long request, ...) { void *ctx; + va_list ap; + va_start(ap, request); + void *arg = va_arg(ap, void *); + va_end(ap); COMMON_INTERCEPTOR_ENTER(ctx, ioctl, d, request, arg); CHECK(ioctl_initialized); Index: lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc =================================================================== --- lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +++ lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc @@ -13,7 +13,7 @@ #include "sanitizer_flags.h" struct ioctl_desc { - unsigned req; + unsigned long req; // FIXME: support read+write arguments. Currently READWRITE and WRITE do the // same thing. // XXX: The declarations below may use WRITE instead of READWRITE, unless @@ -491,10 +491,10 @@ } // Handle the most evil ioctls that encode argument value as part of request id. -static unsigned ioctl_request_fixup(unsigned req) { +static unsigned long ioctl_request_fixup(unsigned long req) { #if SANITIZER_LINUX // Strip size and event number. - const unsigned kEviocgbitMask = + const unsigned long kEviocgbitMask = (IOC_SIZEMASK << IOC_SIZESHIFT) | EVIOC_EV_MAX; if ((req & ~kEviocgbitMask) == IOCTL_EVIOCGBIT) return IOCTL_EVIOCGBIT; @@ -507,7 +507,7 @@ return req; } -static const ioctl_desc *ioctl_table_lookup(unsigned req) { +static const ioctl_desc *ioctl_table_lookup(unsigned long req) { int left = 0; int right = ioctl_table_size; while (left < right) { @@ -523,7 +523,7 @@ return 0; } -static bool ioctl_decode(unsigned req, ioctl_desc *desc) { +static bool ioctl_decode(unsigned long req, ioctl_desc *desc) { CHECK(desc); desc->req = req; desc->name = ""; @@ -554,7 +554,7 @@ return true; } -static const ioctl_desc *ioctl_lookup(unsigned req) { +static const ioctl_desc *ioctl_lookup(unsigned long req) { req = ioctl_request_fixup(req); const ioctl_desc *desc = ioctl_table_lookup(req); if (desc) return desc; @@ -571,7 +571,7 @@ } static void ioctl_common_pre(void *ctx, const ioctl_desc *desc, int d, - unsigned request, void *arg) { + unsigned long request, void *arg) { if (desc->type == ioctl_desc::READ || desc->type == ioctl_desc::READWRITE) { unsigned size = desc->size ? desc->size : IOC_SIZE(request); COMMON_INTERCEPTOR_READ_RANGE(ctx, arg, size); @@ -589,7 +589,7 @@ } static void ioctl_common_post(void *ctx, const ioctl_desc *desc, int res, int d, - unsigned request, void *arg) { + unsigned long request, void *arg) { if (desc->type == ioctl_desc::WRITE || desc->type == ioctl_desc::READWRITE) { // FIXME: add verbose output unsigned size = desc->size ? desc->size : IOC_SIZE(request);