Re: copy_from_user problem

2008-02-27 Thread Benjamin Herrenschmidt
On Wed, 2008-02-27 at 06:27 -0600, Maynard Johnson wrote: > Can't do that in the "real" code I'm developing, so I guess I'll need to > use get_user_pages. Hmmm . . . not quite as simple to use as > copy_from_user, and I don't see any doc on it. But at least I've found > a couple examples in t

Re: copy_from_user problem

2008-02-27 Thread Arnd Bergmann
On Wednesday 27 February 2008, Maynard Johnson wrote: > > Sounds to me that your kernel module will try to copy_from_user() from > > the user context of ... insmod :-) > >   > Yeah, that's probably the problem (along with my lack of understanding > how VM works  -- heh).  I guess I was just getti

Re: copy_from_user problem

2008-02-27 Thread Maynard Johnson
Benjamin Herrenschmidt wrote: > On Tue, 2008-02-26 at 08:49 -0600, Maynard Johnson wrote: > >> 2. Compile C program as 32-bit; then run it. While the program is >> waiting for input, obtain its PID and do 'cat /proc//maps' to >> get >> the address of where libc is loaded. >> 3. From the dir w

Re: copy_from_user problem

2008-02-26 Thread Benjamin Herrenschmidt
On Tue, 2008-02-26 at 08:49 -0600, Maynard Johnson wrote: > 2. Compile C program as 32-bit; then run it. While the program is > waiting for input, obtain its PID and do 'cat /proc//maps' to > get > the address of where libc is loaded. > 3. From the dir where you build the uaccess_test kernel mo

Re: copy_from_user problem

2008-02-26 Thread Maynard Johnson
Nathan Lynch wrote: > Maynard Johnson wrote: >> static long lib_addr; >> module_param(lib_addr, long, 0); > > Should be unsigned long? Right. I switched this to 'ulong', but that didn't make a difference in my test results. > __

Re: copy_from_user problem

2008-02-26 Thread Nathan Lynch
Nathan Lynch wrote: > Maynard Johnson wrote: > > > > static long lib_addr; > > module_param(lib_addr, long, 0); > > Should be unsigned long? ulong, rather, but that doesn't fix it. In any case, lib_addr is a user virtual address; doesn't the kernel need to do get_us

Re: copy_from_user problem

2008-02-26 Thread Nathan Lynch
Maynard Johnson wrote: > > static long lib_addr; > module_param(lib_addr, long, 0); Should be unsigned long? ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: copy_from_user problem

2008-02-26 Thread Maynard Johnson
Benjamin Herrenschmidt wrote: 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 libra

Re: copy_from_user problem

2008-02-25 Thread Paul Mackerras
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 e

Re: copy_from_user problem

2008-02-25 Thread Benjamin Herrenschmidt
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 co

copy_from_user problem

2008-02-25 Thread Maynard Johnson
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,