[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFyB_r5KMJrYMygdkFw-UdxFUCExQJDL-d2Cd+Sk2+xLrw@mail.gmail.com>
Date: Fri, 19 Aug 2016 15:11:05 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Vineet Gupta <Vineet.Gupta1@...opsys.com>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault
On Fri, Aug 19, 2016 at 3:00 PM, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> (I have some experimental patches that actually use "asm goto" in
> "unsafe_put_user()" to get that nice code generation, but they only
> work if your gcc version supports "asm goto", which some older
> versions of gcc does not)
Since you actually are looking at the user access stuff, I'll just put
them here.
This is from an old branch of mine, based on commit f6c658df6385 just
because that happened to be my top-of-tree when I was playing around
with it. It probably doesn't even apply right now, and as mentioned,
it depends on "asm goto" (there is no case for !CC_HAVE_ASM_GOTO).
With this, you actually get almost perfect code generation if you then
replace all the "put_user_ex()" calls with
if (access_ok(..))
return -EFAULT;
user_access_begin();
unsafe_put_user(x,ptr, error_label);
unsafe_put_user(y,ptr2, error_label);
...
user_access_end();
return 0;
error_label:
user_access_end();
return -EFAULT;
or something similar. The exception handler will jump directly to
"error_label", and there will be no testing of anything at all in the
usual no-exception cases, nor will there be any extra registers for
error values etc.
Linus
View attachment "patch.diff" of type "text/plain" (4917 bytes)
Powered by blists - more mailing lists