[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201117022518.GA17555@chenyu-office.sh.intel.com>
Date: Tue, 17 Nov 2020 10:25:18 +0800
From: Chen Yu <yu.c.chen@...el.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Andy Lutomirski <luto@...capital.net>,
Ashok Raj <ashok.raj@...el.com>,
"Hansen, Dave" <dave.hansen@...el.com>,
Len Brown <len.brown@...el.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Tony Luck <tony.luck@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH][v2] x86/microcode/intel: check cpu stepping and
processor flag before saving microcode
Hi Boris,
thanks for taking a look,
On Mon, Nov 16, 2020 at 01:27:35PM +0100, Borislav Petkov wrote:
> ( drop stable@ from Cc because this is not how fixes get added to stable@ )
>
> On Fri, Nov 13, 2020 at 09:59:23AM +0800, Chen Yu wrote:
> > Currently scan_microcode() leverages microcode_matches() to check if the
> > microcode matches the CPU by comparing the family and model. However before
> > saving the microcode in scan_microcode(), the processor stepping and flag
> > of the microcode signature should also be considered in order to avoid
> > incompatible update and caused the failure of microcode update.
>
> This is going in the right direction but needs to take care of one
> more angle. I've extended your fix to the version below. Lemme know if
> something's not clear or still missing.
>
This patch works for me. Besides I have one question about adding the
signature check in save_mc_for_early():
> ---
> From: Chen Yu <yu.c.chen@...el.com>
> Date: Fri, 13 Nov 2020 09:59:23 +0800
> Subject: [PATCH] x86/microcode/intel: Check patch signature before saving microcode for early loading
>
> Currently, scan_microcode() leverages microcode_matches() to check
> if the microcode matches the CPU by comparing the family and model.
> However, the processor stepping and flags of the microcode signature
> should also be considered when saving a microcode patch for early
> update.
>
> Use find_matching_signature() in scan_microcode() and get rid of the
> now-unused microcode_matches() which is a good cleanup in itself.
>
> Complete the verification of the patch being saved for early loading in
> save_microcode_patch() directly. This needs to be done there too because
> save_mc_for_early() will call save_microcode_patch() too.
>
If I understand correctly, the only place that invokes save_mc_for_early()
is in generic_load_microcode(). While in generic_load_microcode() only
microcode has a newer version will be saved by checking has_newer_microcode(),
and this function leverages find_matching_signature() to check if the candidate
is of the same signature. So when it comes to save_microcode_patch(), the signature
already matches. In case save_mc_for_early() will be invoked by other
function in the future, it is okay to add this check too.
thanks,
Chenyu
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists