Re: [RFC] situation with csum_and_copy_... API

From
Al Viro <viro@ZenIV.linux.org.uk>
Date
2014-11-18 21:23:10
Also in
lkml
Reply to
Linus Torvalds, 2014-11-18
On Tue, Nov 18, 2014 at 12:49:13PM -0800, Linus Torvalds wrote:
On Tue, Nov 18, 2014 at 12:47 AM, Al Viro [off-list ref] wrote:
quoted
The minimal implementations would be

__wsum csum_and_copy_from_user(const void __user *src, void *dst, int len,
                               __wsum sum, int *err_ptr)
{
        if (unlikely(copy_from_user(dst, src, len) < 0)) {
No. That "< 0" should be "!= 0". The user copy functions return a
positive value of how many bytes they *failed* to copy.
D'oh...  Yes, indeed - sorry about the braino.
quoted
IMO the calling conventions are atrocious.
Yeah, not pretty. At the same time, the pain of changing what seems to
work might not be worth it.

And quite frankly, I *detest* your patch 3/5.

"access_ok()" isn't that expensive, and removing them as unnecessary
is fraught with errors. We've had several cases of "oops, we used
__get_user() in a loop, because it generates much better code, but
we'd forgotten to do access_ok(), so now people can read kernel data".
OK...  If netdev folks can live with that for now, I've no problem with
dropping 3/5.  However, I really think we need a variant of csum-and-copy
that would _not_ bother with access_ok() longer term.  That can wait, though...
Thread (133 messages) 133 messages, 9 authors, last reply 2015-02-03
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help