copy_from_user problem

Paul Mackerras paulus at samba.org
Tue Feb 26 16:29:50 EST 2008


Maynard Johnson writes:

> I'm developing a kernel module that needs to parse the in-memory ELF 
> objects for a shared library (libc, to be specific).  When running my 
> test on a 32-bit library, it works fine, but for a 64-bit library, the 
> very first copy_from_user() fails:
>     Elf64_Ehdr ehdr;
>     copy_from_user(&ehdr, location_of_lib, sizeof(Elf64_Ehdr);

Should be OK provided location_of_lib is a user address.  I assume you
know that copy_from_user returns the number of bytes *not* copied,
hence a 0 return means success.

> I talked this over a bit with Will Schmidt.  He determined that 
> access_ok (being done as a result of copy_from_user) was failing, but we 

I suggest you print out the value of location_of_lib just to
sanity-check it.

Paul.



More information about the Linuxppc-dev mailing list