Re: objtool clac/stac handling change..

From: Al Viro
Date: Fri Jul 03 2020 - 18:14:40 EST


On Fri, Jul 03, 2020 at 02:10:08PM -0700, Linus Torvalds wrote:

> Yeah, the "stac" instruction isn't hugely fast, and serializes the
> pipeline, so it's a nasty 20 cycles or something.
>
> But for chissake, this
> (a) happens approximately never
> (b) is after a fault that took a thousand cycles
>
> so the trivial thing to do is to just say "yeah, you need to add the
> STAC when your optimistic thing failed and you have to fall back to
> the byte-at-a-time tail case".

Not the problem I'm concerned about, really. However, I would really
like to lift stac/clac into the *callers* of raw_copy_from_user()
et.al. and fold them into user_access_begin/user_access_end there.

And that's where the rules become very interesting - raw_copy_from_user()
is not "succeed or fail" thing, it's "tell me how much has been left
to copy" one. Put it that way - here we really do have outputs on
fault.

PS: I hope to kill __copy_from_user()/__copy_to_user() outside of
arch/* this cycle; not much is left by now. So I'm not talking about
lifting stac/clac out into the wild - it will merge with access_ok
into user_access_begin/end.