Re: [RFC][PATCH 01/22] x86 user stack frame reads: switch to explicit __get_user()
From: Al Viro
Date: Sun Mar 29 2020 - 14:18:45 EST
On Sun, Mar 29, 2020 at 10:56:59AM -0700, Linus Torvalds wrote:
> But, if you have lots of performance-critical get_user() calls, just use
>
> if (user_access_begin(..))
> goto efault;
>
> .. multiple "unsafe_get_user(x,ptr,efault);" ..
>
> user_access_end();
> ...
>
> efault:
> user_access_end();
> return -EFAULT;
>
> and be done with it.
Except that you'd better make that
if (!user_access_begin(...))
return -EFAULT;