Re: [patch 00/38] x86/retbleed: Call depth tracking mitigation

Sami Tolvanen
2022-07-19T17:23:44Z

On Tue, Jul 19, 2022 at 09:27:02AM -0700, Linus Torvalds wrote:
> On Tue, Jul 19, 2022 at 1:26 AM David Laight <David.Laight@aculab.com> wrote:
> >
> > Shouldn't it be testing the value the caller supplied?
>
> Actually, I'm just all confused.
>
> All that verification code is *in* the caller, before the call - to
> verify that the target looks fine.
>
> I think I was confused by the hash thunk above the function also being
> generated with a "cmpl $hash". And I don't even know why that is, and
> why it wasn't just the bare constant.

The preamble hash is encoded into an instruction just to avoid special
casing objtool, which would otherwise get confused about the random
bytes. On arm64, we just emit a bare constant before the function.

Sami