Re: copy_from_user problem
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2008-02-26 02:57:00
On Mon, 2008-02-25 at 19:47 -0600, Maynard Johnson wrote:
Hi,
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);
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
don't know why. I have 32-bit and 64-bit testcases that start up and
then pause, waiting for input. We look at the entry for libc in
/proc/<pid>/maps, and the permissions are the same for both 32-bit and
64-bit.
I've run this test on both a stock SLES 10 SP1 kernel and on 2.6.24.
I'm sure this is a user error, but for the life of me, I don't know what
I'm doing wrong.
Can anyone out there help?I would have to look at the code. Ben.