[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230823055720.GDZOWfwIMn+o7spi8v@fat_crate.local>
Date: Wed, 23 Aug 2023 07:57:20 +0200
From: Borislav Petkov <bp@...en8.de>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Babu Moger <babu.moger@....com>,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>, David.Kaplan@....com,
Andrew Cooper <andrew.cooper3@...rix.com>,
Nikolay Borisov <nik.borisov@...e.com>,
gregkh@...uxfoundation.org, Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 05/22] x86/srso: Fix SBPB enablement for mitigations=off
On Sun, Aug 20, 2023 at 06:19:02PM -0700, Josh Poimboeuf wrote:
> If the user has requested no mitigations with mitigations=off, use the
> lighter-weight SBPB instead of IBPB for other mitigations.
>
> Note that even with mitigations=off, IBPB/SBPB may still be used for
> Spectre v2 user <-> user protection. Whether that makes sense is a
> question for another day.
Well, with my user hat on, off means off.
IINM, spectre_v2_parse_cmdline() will give SPECTRE_V2_CMD_NONE to
spectre_v2_select_mitigation() when mitigations=off.
spectre_v2_user_select_mitigation() will use the
spectre_v2_select_mitigation()'s result, which turn into
SPECTRE_V2_USER_CMD_NONE and then not enable *BPB either.
So even if we set x86_pred_cmd to SBPB here, it won't do anything
because X86_FEATURE_USE_IBPB won't be set and
indirect_branch_prediction_barrier() will be a NOP.
IOW, I think we should separate the check:
if (cpu_mitigations_off())
return;
at the beginning of srso_select_mitigation() so that it is crystal
clear. Maybe even slap a comment over it.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists