From: Chen Yu <yu.c.chen@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>,
Ashok Raj <ashok.raj@intel.com>,
"Hansen, Dave" <dave.hansen@intel.com>,
Len Brown <len.brown@intel.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Tony Luck <tony.luck@intel.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][v2] x86/microcode/intel: check cpu stepping and processor flag before saving microcode
Date: Tue, 17 Nov 2020 10:25:18 +0800 [thread overview]
Message-ID: <20201117022518.GA17555@chenyu-office.sh.intel.com> (raw)
In-Reply-To: <20201116122735.GA1131@zn.tnic>
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@intel.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
next prev parent reply other threads:[~2020-11-17 2:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 1:59 [PATCH][v2] x86/microcode/intel: check cpu stepping and processor flag before saving microcode Chen Yu
2020-11-16 12:27 ` Borislav Petkov
2020-11-16 21:30 ` Raj, Ashok
2020-11-16 21:46 ` Borislav Petkov
2020-11-17 2:25 ` Chen Yu [this message]
2020-11-17 9:18 ` Borislav Petkov
2020-11-17 9:40 ` Chen Yu
2020-11-17 9:37 ` [tip: x86/urgent] x86/microcode/intel: Check patch signature before saving microcode for early loading tip-bot2 for Chen Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201117022518.GA17555@chenyu-office.sh.intel.com \
--to=yu.c.chen@intel.com \
--cc=ashok.raj@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=rjw@rjwysocki.net \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).