From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>,
Keir Fraser <keir@xen.org>
Subject: Re: [PATCH] x86/AMD-ucode: correct multiple container handling
Date: Mon, 15 Dec 2014 11:29:31 +0000 [thread overview]
Message-ID: <548EC61B.6000806@citrix.com> (raw)
In-Reply-To: <548EB4E9020000780004F7BE@mail.emea.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 2240 bytes --]
On 15/12/14 09:16, Jan Beulich wrote:
> Avoid emitting an error message referring to an incorrect or corrupt
> container file just because no entry was found for the running CPU.
>
> Additionally switch the order of data validation and consumption in
> cpu_request_microcode()'s first loop, and also check the types of
> skipped blocks in container_fast_forward().
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> --- a/xen/arch/x86/microcode_amd.c
> +++ b/xen/arch/x86/microcode_amd.c
> @@ -331,12 +331,17 @@ static int container_fast_forward(const
> header[1] == UCODE_EQUIV_CPU_TABLE_TYPE )
> break;
>
> + if ( header[0] != UCODE_UCODE_TYPE )
> + return -EINVAL;
> size = header[1] + SECTION_HDR_SIZE;
> if ( size < PATCH_HDR_SIZE || size_left < size )
> return -EINVAL;
>
> size_left -= size;
> *offset += size;
> +
> + if ( !size_left )
> + return -ENODATA;
> }
>
> return 0;
> @@ -386,10 +391,6 @@ static int cpu_request_microcode(int cpu
> break;
> }
>
> - if ( find_equiv_cpu_id(mc_amd->equiv_cpu_table, current_cpu_id,
> - &equiv_cpu_id) )
> - break;
> -
> /*
> * Could happen as we advance 'offset' early
> * in install_equiv_cpu_table
> @@ -401,7 +402,16 @@ static int cpu_request_microcode(int cpu
> break;
> }
>
> + if ( find_equiv_cpu_id(mc_amd->equiv_cpu_table, current_cpu_id,
> + &equiv_cpu_id) )
> + break;
> +
> error = container_fast_forward(buf, bufsize - offset, &offset);
> + if ( error == -ENODATA )
> + {
> + ASSERT(offset == bufsize);
> + break;
> + }
> if ( error )
> {
> printk(KERN_ERR "microcode: CPU%d incorrect or corrupt container file\n"
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 3006 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-12-15 11:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-15 9:16 [PATCH] x86/AMD-ucode: correct multiple container handling Jan Beulich
2014-12-15 11:29 ` Andrew Cooper [this message]
2014-12-15 15:57 ` Aravind Gopalakrishnan
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=548EC61B.6000806@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=aravind.gopalakrishnan@amd.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.