Re: AUDIT: copy_from_user is a deathtrap.

Andi Kleen (ak@suse.de)
18 May 2002 12:16:40 +0200


Linus Torvalds <torvalds@transmeta.com> writes:

> On Fri, 17 May 2002, Rusty Russell wrote:
> >
> > Sorry I wasn't clear: I'm saying *replace*, not add,
>
> Ok, let _me_ be clear: replacing them with an inferior product that cannot
> tell you partial copies is not going to happen. Not now, not ever. You
> would break all the users who _require_ knowing about a read() that only
> gave you 5 out of 50 bytes.

Are you sure they even exist ? As far as I can see near everybody relies
on zeroing of target on exception instead.

At least for the SSE optimized copy_*_user always would be much better,
because optimizing the miss count is painful from an unrolled loop
and cannot be even done accurately (8 bytes accuracy is best with 8 byte
loads/stored). With that in mind I think the byte count is broken by
design because it cannot be correctly implemented unless you do byte copies.

I remember TCP was given as the prime user when this interface was
introduced in 2.1, but TCP does not use the byte count currently and never has
(in fact the primary memory copy interface of TCP - csum_copy_* - does not
even support it)

-Andi
-
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/