lkml.org 
[lkml]   [2005]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: usb: Patch for USBDEVFS_IOCTL from 32-bit programs
From
Date
On Tue, 2005-10-18 at 11:49 -0700, Pete Zaitcev wrote:

>
> The problem here is that compat_ptr does NOT turn user data pointer
> into a kernel pointer. It's still a user pointer, only sized
> differently. So, when you do set_fs(KERNEL_DS), this pointer
> is invalid (miraclously, it does work on AMD64, so Dell's tests
> pass on their new Xeons).
>
> So, you cannot simply to have a small shim. Instead, you have to allocate
> the buffer, do copy_from_user(), and then call the ioctl. But then,
> it would be a double-copy, when the ioctl allocates the buffer again.
>
> I tweaked this in various ways, and the patch I posted looks like
> the cleanest solution. But please tell me if I miss something obvious.


there is one more option; allocate on the user stack space for a 64 bit
struct, then copy_in_user() the fields to that and then pass the new
pointer to the 64 bit struct to the ioctl.....

Not saying this is better or worse than what you did, it's just another
option.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-10-18 20:55    [W:0.036 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site