[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160821001141.GV2356@ZenIV.linux.org.uk>
Date: Sun, 21 Aug 2016 01:11:44 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
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 Sat, Aug 20, 2016 at 04:32:57PM -0700, Linus Torvalds wrote:
> Anyway, the asm coming out of gcc looks nasty, because it has all the
> ugly section stuiff and fixups for SMAP not existing on some CPU's
> etc. So the resulting fs/readdir.s file is hard to read. But if you
> look at the disassembly at the object file that hides all that (and
> shows what the end result actually is), the actual filldir user
> accesses end up looking beautiful, with no extra code anywhere. An
> exception just goes to the EFAULT handling directly.
>
> Sadly, unsafe_get_user() looking as good does require gcc improvements
> that aren't imminent.
>
> This patch is untested, although the earlier original pre-rebased
> version of it actually got a fair amount of testing on my machine
> (including the filldir use)
Interesting... BTW, how's this in the "really vile tricks" department?
if (!uaccess_begin())
goto fail;
unsafe_...
...
uacess_end();
with uaccess_begin() along the lines of
p = ¤t_thread_info()->foo;
asm
.text:
STAC
*p = 1f
res = true;
2:;
.fixups:
1:res = false;
CLAC
jmp 2;
if (unlikely(res))
asm
clobber everything
res;
and exception handlers in unsafe_... jumping to the address found
in current_thread_info()->foo. AFAICS, it should avoid the problems
with asm goto, right? The branch target is tied to the entry into the
damn series, so it's not as if it could disappear; and path to a branch
cc(1) doesn't see passes through the chunk produced by that asm block
in uaccess_begin(), so if it looks unreachable without taking those branches
into account, it _is_ unreachable.
Powered by blists - more mailing lists