Vinay Venkataraghavan wrote:
But this is not always the case right. The point that
you mention above is specifically why I posted this
question. It could well be the case that the user
space page could be swapped out when the user space
process is blocked. So when the ioctl is serviced in
kernel space, there is no guarantee that the page is
still mapped. This could cause a page fault.
I think this is why we need to do a
copy_to_user/copy_from_user.
I don't think this is actually the case. I'm not entirely sure, but I
believe that if memcpy from user space works at all on a platform, then
if the page is swapped out it will still get swapped in when needed. In
any case, this is not the main reason for using these functions. The
main reason is that memory addresses passed from userspace might not be
valid at all, and reading these addresses directly would cause a kernel
oops in that case. These functions set up an exception handler so that
invalid address reads/writes return failure instead of crashing the system.
--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from [email protected]
Home Page: http://www.roberthancock.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]