Re: [PATCH 26/26] KVM: x86: asi: Add some mitigations on address space transitions

From: Brendan Jackman
Date: Wed Aug 21 2024 - 07:04:51 EST


Hi Shivank,

On Tue, 20 Aug 2024 at 11:52, Shivank Garg <shivankg@xxxxxxx> wrote:
>
> .pushsection .noinstr.text, "ax"
> SYM_CODE_START(fill_return_buffer)
> + UNWIND_HINT_FUNC
> __FILL_RETURN_BUFFER(%_ASM_AX,RSB_CLEAR_LOOPS)
> RET
> SYM_CODE_END(fill_return_buffer)
> +__EXPORT_THUNK(fill_return_buffer)
> .popsection

Thanks a lot for the pointer! UNWIND_HINT_FUNC does indeed seem to be
what I was missing with the objtool warning.

Regarding the build failure, could you share your config/toolchain
info so I can try to reproduce? Would be handy for checking my next
posting. Now I see your mail, it seems surprising that it compiles for
me.

Also while I'm replying to this thread I'll note this:

> + if (!IS_ENABLED(CONFIG_RETPOLINE) ||
> + !cpu_feature_enabled(X86_FEATURE_RSB_VMEXIT))

It's called CONFIG_MITIGATION_RETPOLINE now.

And furthermore, kvm_get_running_vcpu needs to be noinstr, I'm getting
an objtool warning about this that wasn't mentioned in my cover
letter.