Re: Why use copy_from_user/copy_to_user ?

From: Kasper Dupont (
Date: 10/22/04

  • Next message: Mario Schoofs: "Re: Touch screens"
    Date: Fri, 22 Oct 2004 23:41:11 +0200

    "Pete Zaitcev (OTID1)" wrote:
    > On Wed, 20 Oct 2004 16:47:31 -0700, Thomas wrote:
    > > Then why should
    > > the system calls use copy_from_user and copy_to_user to access
    > > user-space memory?
    > Two reasons.

    Actually there are a few more reasons. In some cases
    it might be a problem if the data is changed while the
    system call is using them. If it first performs some
    consistency check and use the data afterwards, the
    program may change the data (possible using threads or
    DMA). Copying the data first prevents the user program
    from providing some good data and later change it.
    Another potential problem is the fact that a user mode
    program can give a pointer to kernel space instead of
    a pointer to user space.

    Kasper Dupont

  • Next message: Mario Schoofs: "Re: Touch screens"