public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <petkovbb@googlemail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andreas Herrmann <herrmann.der.user@googlemail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org,
	Borislav Petkov <borislav.petkov@amd.com>
Subject: Re: [PATCH 1/2] x86, amd-ucode: Check UCODE_MAGIC before loading the container file
Date: Sun, 8 Nov 2009 15:10:17 +0100	[thread overview]
Message-ID: <20091108141017.GA9595@liondog.tnic> (raw)
In-Reply-To: <20091108120418.GV11372@elte.hu>

Hi Ingo,

On Sun, Nov 08, 2009 at 01:04:18PM +0100, Ingo Molnar wrote:
> hm, there's no changelog. How was it found,

code staring :)

> what's the significance,

required by design.

> do we want it for .32 - i suspect we want - but we need a better
> changelog for that.

Yes. How's that?

--
>From f41bced57e05c8adc0d2c13864b6323c191d45d2 Mon Sep 17 00:00:00 2001
From: Borislav Petkov <borislav.petkov@amd.com>
Date: Thu, 29 Oct 2009 14:00:54 +0100
Subject: [PATCH] x86, amd-ucode: Check UCODE_MAGIC before loading the container file

When loading a microcode binary, we should check the microcode magic
value embedded in the image before continuing loading. The original
check got lost somehow so re-add it to the firmware requesting path.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 arch/x86/kernel/microcode_amd.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 366baa1..f4c538b 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -317,6 +317,12 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device)
 		return UCODE_NFOUND;
 	}
 
+	if (*(u32 *)firmware->data != UCODE_MAGIC) {
+		printk(KERN_ERR "microcode: invalid UCODE_MAGIC (0x%08x)\n",
+		       *(u32 *)firmware->data);
+		return UCODE_ERROR;
+	}
+
 	ret = generic_load_microcode(cpu, firmware->data, firmware->size);
 
 	release_firmware(firmware);
-- 
1.6.5


-- 
Regards/Gruss,
    Boris.

  reply	other threads:[~2009-11-08 14:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29 13:45 [PATCH 1/2] x86, amd-ucode: Check UCODE_MAGIC before loading the container file Andreas Herrmann
2009-10-29 13:47 ` [PATCH 2/2] x86, amd-ucode: Remove needless log messages Andreas Herrmann
2009-11-08 14:57   ` Ingo Molnar
2009-11-09 13:35     ` Andreas Herrmann
2009-11-10  5:15   ` [tip:x86/microcode] " tip-bot for Andreas Herrmann
2009-11-08 12:04 ` [PATCH 1/2] x86, amd-ucode: Check UCODE_MAGIC before loading the container file Ingo Molnar
2009-11-08 14:10   ` Borislav Petkov [this message]
2009-11-08 14:55     ` Ingo Molnar
2009-11-10  4:51 ` [tip:x86/urgent] " tip-bot for 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=20091108141017.GA9595@liondog.tnic \
    --to=petkovbb@googlemail.com \
    --cc=borislav.petkov@amd.com \
    --cc=herrmann.der.user@googlemail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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