Re: copy to user space

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

 



Hi,

Did you check for the return code of copy_to_user() [it indicates the number of bytes that remain to be written, i.e. successful completion is indicated by a return value
0]?
I think that writing to the process's code segment fails, because it's write protected (i.e. your return code would equal the number of bytes you requested to copy).
You might try to (temporarily) modify the protection of the corresponding vm_area and/or page table entries, to enable writing to the code segment - it's just an idea, I
don't know, if it works and what side effects this has.

regards
Martin

Luis Miguel Correia Henriques wrote:

> Hi,
>
> how can I copy a stream of bytes to user space? this user space can be
> anywhere in a process space (even code segment...). I tried memcpy but it
> gave me "Unable to handle kernel paging request at virtual address ...".
> With copy_to_user, it seemed to work but, when I tried to verify if it was
> really written, it didn't!
>
> Thanks
>
> Luis Henriques
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> IRC Channel:   irc.openprojects.net / #kernelnewbies
> Web Page:      http://www.kernelnewbies.org/

--
Supercomputing System AG          email: maletinsky@scs.ch
Martin Maletinsky                 phone: +41 (0)1 445 16 05
Technoparkstrasse 1               fax:   +41 (0)1 445 16 10
CH-8005 Zurich


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/



[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