mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Ondrej Zary <linux@rainbow-software.org>
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] OOPS in identify_cpu() on CPUs without CPUID
Date: Sat, 8 Aug 2009 19:53:44 +0200	[thread overview]
Message-ID: <20090808175344.GA8099@elte.hu> (raw)
In-Reply-To: <200908081908.12240.linux@rainbow-software.org>


* Ondrej Zary <linux@rainbow-software.org> wrote:

> Kernel is broken for x86 CPUs without CPUID since 2.6.28. It 
> crashes with NULL pointer dereference in identify_cpu():
> 
> 766        generic_identify(c);
> 767
> 768-->     if (this_cpu->c_identify)
> 769                this_cpu->c_identify(c);
> 
> this_cpu is NULL. This is because it's only initialized in 
> get_cpu_vendor() function, which is not called if the CPU has no 
> CPUID instruction.

indeed ...

> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
> 
> --- linux-2.6.30.4-orig/arch/x86/kernel/cpu/common.c	2009-06-10 05:05:27.000000000 +0200
> +++ linux-2.6.30.4-router/arch/x86/kernel/cpu/common.c	2009-08-08 18:00:21.000000000 +0200
> @@ -699,6 +699,7 @@
>  
>  static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
>  {
> +	this_cpu = &default_cpu;
>  	c->extended_cpuid_level = 0;
>  
>  	if (!have_cpuid_p())

How about initializing this_cpu instead, via:

static const struct cpu_dev *this_cpu __cpuinitdata = &default_cpu;

?
	Ingo

  reply	other threads:[~2009-08-08 17:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-08 17:08 Ondrej Zary
2009-08-08 17:53 ` Ingo Molnar [this message]
2009-08-08 18:19   ` Ondrej Zary
2009-08-09  1:28   ` H. Peter Anvin
2009-08-09 21:12     ` Ondrej Zary
2009-08-09 17:45   ` [PATCH v2] " Ondrej Zary

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=20090808175344.GA8099@elte.hu \
    --to=mingo@elte.hu \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rainbow-software.org \
    --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

Powered by JetHome