[PATCH] increase the upper limit of sg_io64.dxfer_len to make "sg_logs -p=0x0f /dev/sgN" happy

Arnd Bergmann arnd at arndb.de
Tue Feb 15 02:27:43 EST 2005

On Maandag 14 Februar 2005 15:51, David Howells wrote:
> Furthermore, this takes no account of the fact that PAGE_SIZE can be
> changed. If it was, for example, changed to 64KB, you'd be allocating an
> enormous chunk of memory, and only using less than a page in this instance.

Why would anyone want to make such a big change on a three year old kernel?
I'm not even convinced it would be a good idea to support 64k pages on RHEL4,
and that doesn't have this particular problem.

>  (1) pull parameter block into kernel space
>  (2) call verify_area() on the userspace buffers
>  (3) point kernel param block buffer pointers at the userspace buffers
>  (4) set FS selector to KERNEL_DS
>  (5) call sys_ioctl()
>  (6) restore FS selector
> This ought to be sufficient. Setting KERNEL_DS merely disables the address
> bounds checking in access_ok() and verify_area(). These don't actually limit
> kernel pointers to kernel space; so as long as the check is performed
> _somewhere_ before the driver tries to access the buffers, it should be okay.

Of course, such code will be highly non-portable, unlike most other functions
in compat_ioctl.c. The right solution IMHO would be to backport the code from
2.6, which uses compat_alloc_user_space.

	Arnd <><

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20050214/91ff0b63/attachment.pgp 

More information about the Linuxppc64-dev mailing list