Re: [RFC][CFT][PATCHSET v1] uaccess unification
From: Al Viro
Date: Thu Mar 30 2017 - 15:10:22 EST
On Thu, Mar 30, 2017 at 11:59:16AM -0700, Linus Torvalds wrote:
> But regardless of that, I think you're being silly to even look at the
> iovec code. That code simply *isn't* critical enough that one or two
> extra instructions matter.
>
> Show me profiles to the contrary. I dare you.
>
> Those things shouldn't be using *anything* odd at all. They should be
> using "copy_from_user()". Nothing else.
That they very definitely should not. And not because of access_ok() or
might_fault() - this is one place where zero-padding is absolutely wrong.
So unless you are going to take it out of copy_from_user() and pray
that random shit ioctls in random shit drivers check the return value
properly, copy_from_user() is no-go here.