site_archiver@lists.apple.com Delivered-To: Darwin-kernel@lists.apple.com Hello all, So my question on a 32bit kernel is it possible to transform a 64bit userspace uio to a 32bit userspace uio? Thanks, -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... On Apr 6, 2010, at 11:08 PM, Alain Renaud wrote: I am not sure this is possible but here goes. I am working on a filesystem kernel driver on a 10.6 32bit kernel userspace application can send me write request (vnop_write_desc) with a UIO_USERSPACE64 uio. In my code path I pass this uio to the physio() function which try to assign the iovec to a bp->b_datap, to do so it CASTDOWN the 64bit iov_base address to 32bit breaking it. Can you explain who is doing this, or which version of the kernel you are doing this in that has a physio() function that does this? As far as I have been able to determine, there is no Apple code which will call the physio() routine. If you are writing code to do this, you will want to check the bounds on the uio, and if necessary bounce buffer it yourself. This can be accomplished by copying from the user buffer into an appropriately sized kernel buffer, and copying the uio so you can point the uio buffer at the kernel buffer instead of the user buffer, and setting the space to use to UIO_SYSSPACE instead so that it takes it from the kernel buffer you manually copied. My recommendation, however, is to not use physio(), since it's a more or less obsolete interface, and I checked for its use, and no Apple code has used it since at least Tiger (call it six years ago), so I would not have expected it to be very well maintained, in an case. If you get around to it, please file a bug report asking us to deprecate the interface in a future release, and then delete it in a release after the one in which it's deprecated. This email sent to site_archiver@lists.apple.com