Re: [PATCH 3/4] x86/retpoline: Simplify vmexit_fill_RSB()

From: David Woodhouse
Date: Fri Jan 26 2018 - 07:33:39 EST


On Fri, 2018-01-26 at 13:11 +0100, Borislav Petkov wrote:
>
> +ENTRY(__fill_rsb_clobber_ax)
> +ÂÂÂÂÂÂÂ___FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, %_ASM_SP
> +END(__fill_rsb_clobber_ax)
> +EXPORT_SYMBOL_GPL(__fill_rsb_clobber_ax)

You still have clear vs. fill confusion there.

How about making it take the loop count in %eax? That would allow us to
drop the ___FILL_RETURN_BUFFER macro entirely.

Or does that make us depend on your other fixes to accept jumps in
places other than the first instruction of altinstr?Â

Even if you give us separate __clear_rsb_clobber_ax vs.
__fill_rsb_clobber_ax functions, we could still kill the macro in
nospec-branch.h and use a .macro in retpoline.S for the actual
implementation, couldn't we?

> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -971,4 +971,9 @@ bool xen_set_default_idle(void);
> Â
> Âvoid stop_this_cpu(void *dummy);
> Âvoid df_debug(struct pt_regs *regs, long error_code);
> +
> +#ifdef CONFIG_RETPOLINE
> +asmlinkage void __fill_rsb_clobber_ax(void);
> +#endif
> +
> Â#endif /* _ASM_X86_PROCESSOR_H */

Doesn't that live in asm-prototypes.h? Don't make it visible to any C
code; it *isn't* a C function.

Attachment: smime.p7s
Description: S/MIME cryptographic signature