Re: copy_to_user() and copy_from_user(): confusing code

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

 



Hi mohit,

On Sun, Sep 26, 2010 at 7:38 AM, mohit verma <mohit89mlnc@xxxxxxxxx> wrote:
> guysssss,
>
> will u please highlight some corner points of copy_to/from_user program (the
> motive of this thread )?

What I recall from copy_to/from_user when I looked at how it was
implemented on the ARM several years ago (and this might have been
with the 2.4 version of the kernel - I don't recall), is that it
registers with the linux exception framework (which is non-trivial
IIRC) so that if it tries to access a region of memory which isn't
mapped then it causes a special type of exception rather than a normal
pagefault.

It also deals with the different address spaces. On the ARM, it turns
out that nothing really special is required. You can use memcpy and
get the same results as copy_to/from_user when the pointers and sizes
are valid. However, if an invalid pointer gets passed to memcpy, it
will cause a fault, whereas copy_to/from_user intercepts the fault
with the exception handler

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux