Re: [PATCH 04/22] x86/srso: Fix SBPB enablement for spec_rstack_overflow=off
From: Borislav Petkov
Date: Tue Aug 22 2023 - 01:54:54 EST
On Mon, Aug 21, 2023 at 09:36:49AM -0700, Josh Poimboeuf wrote:
> Hm? How exactly is this overriding the retbleed IBPB mitigation?
Sorry, clearly -ETOOMANYMITIGATIONS.
I meant the spectre_v2_user thing which does
indirect_branch_prediction_barrier() based on X86_FEATURE_USE_IBPB.
indirect_branch_prediction_barrier() uses x86_pred_cmd to select which
MSR bits to set and it is initialized by default to PRED_CMD_IBPB.
If you goto pred_cmd, you will overwrite it with PRED_CMD_SBPB here.
I think it should not overwrite it and simply return like before.
Meaning: if SRSO mitigation is off but the spectre_v2_user isn't so you
get what you want.
If you do mitigations=off - which is what most use cases do when they
don't care about mitigations - then it'll work too.
I don't see a sensible use case where user->user spectre_v2 is enabled
but SRSO is off. Maybe there is...
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette