Re: [PATCH v2] x86/bugs: Explicitly clear speculative MSR bits

2022-11-28 Thread Pawan Gupta
On Mon, Nov 28, 2022 at 03:02:21PM -0800, Pawan Gupta wrote: On Mon, Nov 28, 2022 at 11:40:19PM +0100, Borislav Petkov wrote: On Mon, Nov 28, 2022 at 02:03:58PM -0800, Pawan Gupta wrote: diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 3e3230cccaa7..cfc2ed2661fc

Re: [PATCH v2] x86/bugs: Explicitly clear speculative MSR bits

2022-11-28 Thread Borislav Petkov
On Mon, Nov 28, 2022 at 03:02:19PM -0800, Pawan Gupta wrote: > Yes thats a cleaner approach, except that the late microcode load will > ruin the MSR: > > microcode_reload_late() > microcode_check() > get_cpu_cap() > init_speculation_control() Microcode late loading ruins a lot of

Re: [PATCH v2] x86/bugs: Explicitly clear speculative MSR bits

2022-11-28 Thread Pawan Gupta
On Mon, Nov 28, 2022 at 11:40:19PM +0100, Borislav Petkov wrote: On Mon, Nov 28, 2022 at 02:03:58PM -0800, Pawan Gupta wrote: diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 3e3230cccaa7..cfc2ed2661fc 100644 --- a/arch/x86/kernel/cpu/bugs.c +++

Re: [PATCH v2] x86/bugs: Explicitly clear speculative MSR bits

2022-11-28 Thread Borislav Petkov
On Mon, Nov 28, 2022 at 02:03:58PM -0800, Pawan Gupta wrote: > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c > index 3e3230cccaa7..cfc2ed2661fc 100644 > --- a/arch/x86/kernel/cpu/bugs.c > +++ b/arch/x86/kernel/cpu/bugs.c > @@ -66,7 +66,7 @@ static

Re: [PATCH v2] x86/bugs: Explicitly clear speculative MSR bits

2022-11-28 Thread Pawan Gupta
On Mon, Nov 28, 2022 at 01:42:26AM +0100, Borislav Petkov wrote: On Thu, Nov 24, 2022 at 02:46:50AM -0800, Breno Leitao wrote: Currently x86_spec_ctrl_base is read at boot time, and speculative bits are set if configs are enable, such as MSR[SPEC_CTRL_IBRS] is enabled if CONFIG_CPU_IBRS_ENTRY

Re: [PATCH v2] x86/bugs: Explicitly clear speculative MSR bits

2022-11-27 Thread Borislav Petkov
On Thu, Nov 24, 2022 at 02:46:50AM -0800, Breno Leitao wrote: > Currently x86_spec_ctrl_base is read at boot time, and speculative bits > are set if configs are enable, such as MSR[SPEC_CTRL_IBRS] is enabled if > CONFIG_CPU_IBRS_ENTRY is configured. These MSR bits are not cleared if > the

[PATCH v2] x86/bugs: Explicitly clear speculative MSR bits

2022-11-24 Thread Breno Leitao
Currently x86_spec_ctrl_base is read at boot time, and speculative bits are set if configs are enable, such as MSR[SPEC_CTRL_IBRS] is enabled if CONFIG_CPU_IBRS_ENTRY is configured. These MSR bits are not cleared if the mitigations are disabled. This is a problem when kexec-ing a kernel that has