Re: AUDIT: copy_from_user is a deathtrap.

Pavel Machek (pavel@suse.cz)
Wed, 22 May 2002 16:42:36 +0200


Hi!

> > In such case, linus, here is your "reasonable" example. For PPro, it
> > is faster to copy out-of-order, and if we wanted to use that for
> > copy_to_user, you'd have your example.
>
> I think there is a misunderstanding here.
>
> Nothing in the standards says that
>
> write(pipe_fd, halfmappedbuffer, 2*PAGE_SIZE)
>
>
> must return PAGE_SIZE on an error. What it seems to say is that it if an error
> is reported then no data got written down the actual pipe itself. Putting
> 4K into the pipe then reporting Esomething is not allowed. Copying 4K into
> a buffer faulting and erroring with Efoo then throwing away the buffer is
> allowed

So... Is copy_to_user allowed to copy more than it actually reported?
Because if so, it might return 0/-EFAULT as well ;-).

Pavel

-- 
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/