Re: [PATCH] x86/CPU/AMD: Make sure EFER[AIBRSE] is set

From: Dave Hansen
Date: Mon Feb 27 2023 - 10:25:06 EST


On 2/25/23 04:21, Borislav Petkov wrote:
> + /*
> + * Make sure EFER[AIBRSE - Automatic IBRS Enable] is set. The APs are brought up
> + * using the trampoline code and as part of it, EFER gets prepared there in order
> + * to be replicated onto them. Regardless, set it here again, if not set, to protect
> + * against any future refactoring/code reorganization which might miss setting
> + * this important bit.
> + */
> + if (spectre_v2_in_ibrs_mode(spectre_v2_enabled) &&
> + cpu_has(c, X86_FEATURE_AUTOIBRS))
> + msr_set_bit(MSR_EFER, _EFER_AUTOIBRS);
> }

I guess the belt and suspenders could be justified here by how important
the bit is.

But, if EFER[AIBRSE] gets clear somehow shouldn't we also dump a warning
out here so the fool who botched it can fix it? Even if AIBRSE is fixed
up, some less important bit could still be botched.

It will freak some users out, but it does seem like the kind of thing we
_want_ a bug report for.