[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141118212307.GU7996@ZenIV.linux.org.uk>
Date: Tue, 18 Nov 2014 21:23:07 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Network Development <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] situation with csum_and_copy_... API
On Tue, Nov 18, 2014 at 12:49:13PM -0800, Linus Torvalds wrote:
> On Tue, Nov 18, 2014 at 12:47 AM, Al Viro <viro@...iv.linux.org.uk> wrote:
> > 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.
> > 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...
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists