* [PATCH 1/2] x86, amd-ucode: Check UCODE_MAGIC before loading the container file
@ 2009-10-29 13:45 Andreas Herrmann
2009-10-29 13:47 ` [PATCH 2/2] x86, amd-ucode: Remove needless log messages Andreas Herrmann
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Andreas Herrmann @ 2009-10-29 13:45 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: linux-kernel, Borislav Petkov
>From 5183dd763c6dc9f760e29f3313e0ae3dda5228a2 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 1/2] x86, amd-ucode: Check UCODE_MAGIC before loading the container file
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.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] x86, amd-ucode: Remove needless log messages
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 ` Andreas Herrmann
2009-11-08 14:57 ` Ingo Molnar
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-10 4:51 ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2 siblings, 2 replies; 9+ messages in thread
From: Andreas Herrmann @ 2009-10-29 13:47 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: linux-kernel, Borislav Petkov
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
arch/x86/kernel/microcode_amd.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index f4c538b..c043534 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -109,12 +109,8 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
return 0;
}
- if (mc_header->processor_rev_id != equiv_cpu_id) {
- printk(KERN_ERR "microcode: CPU%d: patch mismatch "
- "(processor_rev_id: %x, equiv_cpu_id: %x)\n",
- cpu, mc_header->processor_rev_id, equiv_cpu_id);
+ if (mc_header->processor_rev_id != equiv_cpu_id)
return 0;
- }
/* ucode might be chipset specific -- currently we don't support this */
if (mc_header->nb_dev_id || mc_header->sb_dev_id) {
@@ -185,9 +181,6 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
total_size = (unsigned long) (section_hdr[4] + (section_hdr[5] << 8));
- printk(KERN_DEBUG "microcode: size %u, total_size %u\n",
- size, total_size);
-
if (total_size > size || total_size > UCODE_MAX_SIZE) {
printk(KERN_ERR "microcode: error: size mismatch\n");
return NULL;
--
1.6.5.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] x86, amd-ucode: Check UCODE_MAGIC before loading the container file
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 12:04 ` Ingo Molnar
2009-11-08 14:10 ` Borislav Petkov
2009-11-10 4:51 ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2 siblings, 1 reply; 9+ messages in thread
From: Ingo Molnar @ 2009-11-08 12:04 UTC (permalink / raw)
To: Andreas Herrmann
Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel, Borislav Petkov
* Andreas Herrmann <herrmann.der.user@googlemail.com> wrote:
> >From 5183dd763c6dc9f760e29f3313e0ae3dda5228a2 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 1/2] x86, amd-ucode: Check UCODE_MAGIC before loading the container file
>
> 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);
hm, there's no changelog. How was it found, what's the significance, do
we want it for .32 - i suspect we want - but we need a better changelog
for that.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] x86, amd-ucode: Check UCODE_MAGIC before loading the container file
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
2009-11-08 14:55 ` Ingo Molnar
0 siblings, 1 reply; 9+ messages in thread
From: Borislav Petkov @ 2009-11-08 14:10 UTC (permalink / raw)
To: Ingo Molnar
Cc: Andreas Herrmann, Thomas Gleixner, H. Peter Anvin, linux-kernel,
Borislav Petkov
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.
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] x86, amd-ucode: Check UCODE_MAGIC before loading the container file
2009-11-08 14:10 ` Borislav Petkov
@ 2009-11-08 14:55 ` Ingo Molnar
0 siblings, 0 replies; 9+ messages in thread
From: Ingo Molnar @ 2009-11-08 14:55 UTC (permalink / raw)
To: Borislav Petkov, Andreas Herrmann, Thomas Gleixner,
H. Peter Anvin, linux-kernel, Borislav Petkov
* Borislav Petkov <petkovbb@googlemail.com> wrote:
> 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(-)
Looks good - thanks!
Ingo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] x86, amd-ucode: Remove needless log messages
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
1 sibling, 1 reply; 9+ messages in thread
From: Ingo Molnar @ 2009-11-08 14:57 UTC (permalink / raw)
To: Andreas Herrmann
Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel, Borislav Petkov
* Andreas Herrmann <herrmann.der.user@googlemail.com> wrote:
>
> Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
> ---
> arch/x86/kernel/microcode_amd.c | 9 +--------
> 1 files changed, 1 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
> index f4c538b..c043534 100644
> --- a/arch/x86/kernel/microcode_amd.c
> +++ b/arch/x86/kernel/microcode_amd.c
> @@ -185,9 +181,6 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
>
> total_size = (unsigned long) (section_hdr[4] + (section_hdr[5] << 8));
>
> - printk(KERN_DEBUG "microcode: size %u, total_size %u\n",
> - size, total_size);
> -
we should remove this one indeed.
> @@ -109,12 +109,8 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
> return 0;
> }
>
> - if (mc_header->processor_rev_id != equiv_cpu_id) {
> - printk(KERN_ERR "microcode: CPU%d: patch mismatch "
> - "(processor_rev_id: %x, equiv_cpu_id: %x)\n",
> - cpu, mc_header->processor_rev_id, equiv_cpu_id);
> + if (mc_header->processor_rev_id != equiv_cpu_id)
> return 0;
> - }
>
> /* ucode might be chipset specific -- currently we don't support this */
> if (mc_header->nb_dev_id || mc_header->sb_dev_id) {
but why remove this one? Someone tries to load a mismatching microcode
file, isnt that some sort of bug in user-space? (Which ought to find out
whether it has anything for the CPU at hand, and only attempt it if it's
matching - or so.)
maybe it's not a KERN_ERR but KERN_INFO, but still.
Ingo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] x86, amd-ucode: Remove needless log messages
2009-11-08 14:57 ` Ingo Molnar
@ 2009-11-09 13:35 ` Andreas Herrmann
0 siblings, 0 replies; 9+ messages in thread
From: Andreas Herrmann @ 2009-11-09 13:35 UTC (permalink / raw)
To: Ingo Molnar
Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel, Borislav Petkov
On Sun, Nov 08, 2009 at 03:57:48PM +0100, Ingo Molnar wrote:
>
> * Andreas Herrmann <herrmann.der.user@googlemail.com> wrote:
[...]
> > - if (mc_header->processor_rev_id != equiv_cpu_id) {
> > - printk(KERN_ERR "microcode: CPU%d: patch mismatch "
> > - "(processor_rev_id: %x, equiv_cpu_id: %x)\n",
> > - cpu, mc_header->processor_rev_id, equiv_cpu_id);
> > + if (mc_header->processor_rev_id != equiv_cpu_id)
> > return 0;
> > - }
> >
> > /* ucode might be chipset specific -- currently we don't support this */
> > if (mc_header->nb_dev_id || mc_header->sb_dev_id) {
>
> but why remove this one? Someone tries to load a mismatching microcode
> file, isnt that some sort of bug in user-space? (Which ought to find out
> whether it has anything for the CPU at hand, and only attempt it if it's
> matching - or so.)
The ucode file that we provide contains many ucode patches -- its a
"container" file providing patches for several CPUs. Of course this
means that there are patches in the file which are not meant for that
CPU -- that is no error case but rather normal.
> maybe it's not a KERN_ERR but KERN_INFO, but still.
KERN_DEBUG at the most. It's simple as that: if the CPU has same
PATCH_LEVEL before and after microcode.ko tried to update the ucode,
there either was no ucode-file available or it just didn't contain a
newer ucode version for this CPU.
Andreas
^ permalink raw reply [flat|nested] 9+ messages in thread
* [tip:x86/urgent] x86, amd-ucode: Check UCODE_MAGIC before loading the container file
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 12:04 ` [PATCH 1/2] x86, amd-ucode: Check UCODE_MAGIC before loading the container file Ingo Molnar
@ 2009-11-10 4:51 ` tip-bot for Borislav Petkov
2 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Borislav Petkov @ 2009-11-10 4:51 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, andreas.herrmann3, tglx, mingo,
borislav.petkov
Commit-ID: 506f90eeae682dc96c11c7aefac0262b3a560b49
Gitweb: http://git.kernel.org/tip/506f90eeae682dc96c11c7aefac0262b3a560b49
Author: Borislav Petkov <borislav.petkov@amd.com>
AuthorDate: Thu, 29 Oct 2009 14:45:52 +0100
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 10 Nov 2009 05:46:09 +0100
x86, amd-ucode: Check UCODE_MAGIC before loading the container file
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
LKML-Reference: <20091029134552.GC30802@alberich.amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
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);
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:x86/microcode] x86, amd-ucode: Remove needless log messages
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-10 5:15 ` tip-bot for Andreas Herrmann
1 sibling, 0 replies; 9+ messages in thread
From: tip-bot for Andreas Herrmann @ 2009-11-10 5:15 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, andreas.herrmann3, herrmann.der.user,
tglx, borislav.petkov, mingo
Commit-ID: 6e18da75c28b592594fd632cf3e6eb09d3d078de
Gitweb: http://git.kernel.org/tip/6e18da75c28b592594fd632cf3e6eb09d3d078de
Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
AuthorDate: Thu, 29 Oct 2009 14:47:42 +0100
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 10 Nov 2009 05:49:28 +0100
x86, amd-ucode: Remove needless log messages
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Borislav Petkov <borislav.petkov@amd.com>
LKML-Reference: <20091029134742.GD30802@alberich.amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/microcode_amd.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index f4c538b..c043534 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -109,12 +109,8 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
return 0;
}
- if (mc_header->processor_rev_id != equiv_cpu_id) {
- printk(KERN_ERR "microcode: CPU%d: patch mismatch "
- "(processor_rev_id: %x, equiv_cpu_id: %x)\n",
- cpu, mc_header->processor_rev_id, equiv_cpu_id);
+ if (mc_header->processor_rev_id != equiv_cpu_id)
return 0;
- }
/* ucode might be chipset specific -- currently we don't support this */
if (mc_header->nb_dev_id || mc_header->sb_dev_id) {
@@ -185,9 +181,6 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
total_size = (unsigned long) (section_hdr[4] + (section_hdr[5] << 8));
- printk(KERN_DEBUG "microcode: size %u, total_size %u\n",
- size, total_size);
-
if (total_size > size || total_size > UCODE_MAX_SIZE) {
printk(KERN_ERR "microcode: error: size mismatch\n");
return NULL;
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-11-10 5:15 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-11-08 14:55 ` Ingo Molnar
2009-11-10 4:51 ` [tip:x86/urgent] " tip-bot for Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox