Re: Why use copy_from_user/copy_to_user ?

From: Kasper Dupont (kasperd_at_daimi.au.dk)
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"

    Relevant Pages

    • Re: Why use copy_from_user/copy_to_user ?
      ... > Actually there are a few more reasons. ... Copying the data first prevents the user program ... > program can give a pointer to kernel space instead of ... > a pointer to user space. ...
      (comp.os.linux.development.system)
    • Re: if(a);
      ... > is better style than if, for at least two reasons: ... pointer operations is a recipie for disaster anyway. ... Readability certainly is a function of audience, ... interpretation is performed by the reader, ...
      (comp.lang.c)
    • Re: Interface / Implementation sections
      ... reasons. ... p: POINTER TO INTEGER; ... 'Zonnon' does use words for the visibility attributes: ...
      (borland.public.delphi.non-technical)
    • Re: why use -> (not .) with pointers?
      ... good reasons to do so. ... you whether x is a pointer or a struct without having to ... they can create pointer-like objects ("smart ... it "looks like some other languates". ...
      (comp.lang.c)
    • Re: intent(out) for pointer dummy argument
      ... utility of "intent" for a pointer because presumably this leads ... for a non-pointer causes undefinition in much the same way. ... It has the same reasons and uses. ... Much of the reason for adding intent ...
      (comp.lang.fortran)