Re: [PATCH RFC 0/2] x86/fpu: avoid "xstate_fault" in xsave_user/xrestore_user

Quentin Casasnovas
2015-03-17T10:06:09Z

On Tue, Mar 17, 2015 at 10:47:50AM +0100, Borislav Petkov wrote:
>
> We can even go a step further and add a static_cpu_has_safe thing which
> checks two features instead of one. The penalty we'd get is a single
> inconditional JMP which in the face of XSAVE* is nothing.
>

What was the argument against adding a check_alternative_input(...) so the
ex_table entry are managed inside the macro directly? It leaves less room
for errors and would still be reable IMO:

err = check_alternative_input_2(XSAVE,
XSAVESOPT, X86_FEATURE_XSAVEOPT
XSAVES, X86_FEATURE_XSAVES,
<inputs>, <outputs>, <clobbers>);
if (err)
do_something();

That hypothetical check_alternative_input_2() would call a rework of
check_insn() supporting an arbitrary numbers of inputs, outputs and
clobbers as drafted in my previous e-mail.

Quentin