Re: objtool clac/stac handling change..

From: Al Viro
Date: Thu Jul 02 2020 - 16:59:14 EST


On Thu, Jul 02, 2020 at 01:32:34PM -0700, Linus Torvalds wrote:

> Ugh, the above is bad anyway.
>
> It doesn't use _ASM_EXTABLE_UA, so it won't warn about the noncanonical cases.

FWIW, the address is inside a sigframe we decided to build, so noncanonical
addresses shouldn't occur in practice.

> Yeah, it would need to be turned into a "jump out" instead of just "jump over".
>
> Which it damn well should do anyway.,
>
> That code should be taken behind a shed and shot. It does so many
> things wrong that it's not even funny. It shouldn't do stac/clac on
> its own.
>
> At least it could use the "user_insn()" helper, which does it inside
> the asm itself, has the right might_fault() marking (but not the
> address check), and which can be trivially changed to have the fixup
> jump be to after the "ASM_CLAC".

I'm not sure it's the right solution in this case. Look at the call chain
and the stuff done nearby (that __clear_user(), for example)...

I'm not saying that this code is not awful - it certainly is. But it's
not that simple, unfortunately ;-/