bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ioctl-patch for Darwin and FreeBSD


From: Eric Blake
Subject: Re: ioctl-patch for Darwin and FreeBSD
Date: Tue, 22 Feb 2011 14:53:43 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

[re-adding the list]
[please don't top-post on technical lists]

On 02/22/2011 02:14 PM, Markus Gothe wrote:
> The issue is with PIMd-NG (http://pimd-ng.sf.net).
...

I'm not sure if you emailed me privately because of sensitive content in
your email, but hopefully I've trimmed enough of your content to avoid
risking any public exposure of a security issue, if that was your intent
behind mailing just me instead of the list.

> 
> For some reason FreeBSD chose 'unsigned long' for the request part instead of 
> the 'signed int'-POSIX variant argument to ioctl().

We know.  And the configure test should be detecting that, as well as
letting rpl_ioctl work around that.

Maybe the real problem is that we need to ensure that our replacement
does not do sign extension.  Does this patch fix your issue?

diff --git i/lib/ioctl.c w/lib/ioctl.c
index 72f9f37..3ed4327 100644
--- i/lib/ioctl.c
+++ w/lib/ioctl.c
@@ -37,7 +37,11 @@ rpl_ioctl (int fd, int request, ... /* {void *,char
*} arg */)
   buf = va_arg (args, void *);
   va_end (args);

-  return ioctl (fd, request, buf);
+  /* Generally, this replacement function is in effect when the system
+     ioctl expects unsigned long int.  If request has the most
+     significant bit set, then we need to make sure that
+     sign-extension does not come into play.  */
+  return ioctl (fd, (unsigned long) request, buf);
 }

 #else /* mingw */



-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]