public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
Cc: Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] x86/microcode/AMD: check microcode file sanity before loading it
Date: Mon, 12 Mar 2018 14:48:53 +0100	[thread overview]
Message-ID: <20180312134853.GD9431@pd.tnic> (raw)
In-Reply-To: <df1e721c-f030-68b4-f197-2592bce97bbf@maciej.szmigiero.name>

On Mon, Mar 12, 2018 at 02:32:30PM +0100, Maciej S. Szmigiero wrote:
> "microcode_amd.bin" in linux-firmware.

That is the microcode container for all families < 0x15. And it
*happens* to have 18 entries.

So purely arbitrary:

Equivalence table (magic: AMD, type: 0, length: 288 (0x120))
============================================================
|  inst_cpu  |   err_msk  |   err_cmp  | eq_cpu |   res  |
==========================================================
| 0x00100f80 | 0x00000000 | 0x00000000 | 0x1080 | 0x0000 |
| 0x00100f81 | 0x00000000 | 0x00000000 | 0x1081 | 0x0000 |
| 0x00100f62 | 0x00000000 | 0x00000000 | 0x1062 | 0x0000 |
| 0x00100f23 | 0x00000000 | 0x00000000 | 0x1022 | 0x0000 |
| 0x00100f43 | 0x00000000 | 0x00000000 | 0x1043 | 0x0000 |
| 0x00100f91 | 0x00000000 | 0x00000000 | 0x1081 | 0x0000 |
| 0x00100f2a | 0x00000000 | 0x00000000 | 0x1020 | 0x0000 |
| 0x00100f63 | 0x00000000 | 0x00000000 | 0x1043 | 0x0000 |
| 0x00100f42 | 0x00000000 | 0x00000000 | 0x1041 | 0x0000 |
| 0x00300f10 | 0x00000000 | 0x00000000 | 0x3010 | 0x0000 |
| 0x00200f31 | 0x00000000 | 0x00000000 | 0x2031 | 0x0000 |
| 0x00100f52 | 0x00000000 | 0x00000000 | 0x1041 | 0x0000 |
| 0x00100fa0 | 0x00000000 | 0x00000000 | 0x10a0 | 0x0000 |
| 0x00100f53 | 0x00000000 | 0x00000000 | 0x1043 | 0x0000 |
| 0x00100f22 | 0x00000000 | 0x00000000 | 0x1022 | 0x0000 |
| 0x00500f10 | 0x00000000 | 0x00000000 | 0x5010 | 0x0000 |
| 0x00500f20 | 0x00000000 | 0x00000000 | 0x5020 | 0x0000 |
| 0x00000000 | 0x00000000 | 0x00000000 | 0x0000 | 0x0000 |

> There is no problem raising this value in that (future) case.
> As I wrote previously, currently the maximum used count is 18.

There is a problem because not everyone can upgrade their kernels
like you. Distros and big deployments can't just up and update their
kernels at a whim just because you imposed an arbitrary limit which you
determined would be ok.

> Not really, since even in the existing code CONTAINER_HDR_SZ (12) gets
> added to this size, then the sum is cast to a (signed) int.
> If this value is negative then the file get rejected.

That is a bug in install_equiv_cpu_table() - it should return unsigned int.

> It can be changed to the current maximum across sizes for particular

What is the "current maximum across sizes"?

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

  reply	other threads:[~2018-03-12 13:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-11 15:27 [PATCH v2] x86/microcode/AMD: check microcode file sanity before loading it Maciej S. Szmigiero
2018-03-12  9:53 ` Borislav Petkov
2018-03-12 12:56   ` Maciej S. Szmigiero
2018-03-12 13:06     ` Borislav Petkov
2018-03-12 13:32       ` Maciej S. Szmigiero
2018-03-12 13:48         ` Borislav Petkov [this message]
2018-03-12 14:10           ` Maciej S. Szmigiero
2018-03-12 14:30             ` Borislav Petkov

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=20180312134853.GD9431@pd.tnic \
    --to=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@maciej.szmigiero.name \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --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