[lkml]   [2002]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: AUDIT: copy_from_user is a deathtrap.

    On Sun, 19 May 2002, Linus Torvalds wrote:

    > A faulting write will fill some subsequent memory area with zeroes, but a
    > subsequent write can complete the original one.
    > It has to _commit_ the whole area, because it uses the pre-fault size
    > information to optimize away reads etc, ie if you do a
    > write(fd, buf, 4096);
    > at a page-aligned offset, the write code knows that it shouldn't read the
    > old contents because they get overwritten.
    > Which is why we need to commit the whole 4096 bytes, even if we only
    > actually were able to get a single byte from user space.

    I basically agree, but I think there is a special case: writing at the end
    of the file. Instead of writing zeros, we have to truncate the file,
    otherwise you can't restart append writes. Currently we get this wrong.

    bye, Roman

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:22    [W:0.027 / U:85.028 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site