Thread (11 messages) 11 messages, 5 authors, 2008-02-27

Re: copy_from_user problem

From: Paul Mackerras <hidden>
Date: 2008-02-26 05:29:50

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help