mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: righiandr@users.sourceforge.net, torvalds@osdl.org,
	linux-kernel@vger.kernel.org, patches@x86-64.org
Subject: [PATCH for 2.6.22] [1/10] i386: bug in i386 MTRR initialization
Date: Wed, 20 Jun 2007 12:23:29 +0200 (CEST)	[thread overview]
Message-ID: <20070620102329.9248A14ACF@wotan.suse.de> (raw)
In-Reply-To: <200706201223.443613000@suse.de>


From: Andrea Righi <righiandr@users.sourceforge.net>
BUG: at include/linux/slub_def.h:77 kmalloc_index()
 [<c0168eb0>] get_slab+0x1d0/0x260
 [<c0169056>] __kmalloc+0x16/0x70
 [<c042b0ff>] sysenter_setup+0x6f/0x330
 [<c010baed>] mtrr_bp_init+0xcd/0x270
 [<c041a480>] unknown_bootoption+0x0/0x250
 [<c041a480>] unknown_bootoption+0x0/0x250
 [<c0423f78>] check_bugs+0x8/0x160
 [<c01a644c>] proc_sys_init+0xc/0x30
 [<c041a8ef>] start_kernel+0x21f/0x2b0
 [<c041a480>] unknown_bootoption+0x0/0x250
 =======================

Reproduced running 2.6.22-rc2 (using SLUB) in a virtual machine with qemu 0.9.0
+ kqemu 1.3.0pre11. It occurs only using "-kernel-kqemu" option (full
virtualization mode).

In this case mtrr is supported by the real cpu, but no mtrr range is found,
resulting in a kmalloc(0, GFP_KERNEL) in get_mtrr_state() and init_table().

I don't know if it's an incorrect behaviour of qemu in the mtrr emulation, but I
think it should be handled properly.

Signed-off-by: Andrea Righi <a.righi@cineca.it>
Signed-off-by: Andi Kleen <ak@suse.de>

---
 arch/i386/kernel/cpu/mtrr/generic.c |    3 +++
 arch/i386/kernel/cpu/mtrr/main.c    |    5 +++++
 2 files changed, 8 insertions(+)

Index: linux/arch/i386/kernel/cpu/mtrr/generic.c
===================================================================
--- linux.orig/arch/i386/kernel/cpu/mtrr/generic.c
+++ linux/arch/i386/kernel/cpu/mtrr/generic.c
@@ -84,6 +84,9 @@ void get_mtrr_state(void)
 	struct mtrr_var_range *vrs;
 	unsigned lo, dummy;
 
+	if (!num_var_ranges)
+		return;
+
 	if (!mtrr_state.var_ranges) {
 		mtrr_state.var_ranges = kmalloc(num_var_ranges * sizeof (struct mtrr_var_range), 
 						GFP_KERNEL);
Index: linux/arch/i386/kernel/cpu/mtrr/main.c
===================================================================
--- linux.orig/arch/i386/kernel/cpu/mtrr/main.c
+++ linux/arch/i386/kernel/cpu/mtrr/main.c
@@ -120,6 +120,11 @@ static void __init init_table(void)
 {
 	int i, max;
 
+	if (!num_var_ranges) {
+		printk(KERN_ERR "mtrr: no MTRR range found.\n");
+		return;
+	}
+
 	max = num_var_ranges;
 	if ((usage_table = kmalloc(max * sizeof *usage_table, GFP_KERNEL))
 	    == NULL) {

  reply	other threads:[~2007-06-20 10:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-20 10:23 [PATCH for 2.6.22] [0/10] X86 late bug fixes for 2.6.22 Andi Kleen
2007-06-20 10:23 ` Andi Kleen [this message]
2007-06-20 21:16   ` [PATCH for 2.6.22] [1/10] i386: bug in i386 MTRR initialization Linus Torvalds
2007-06-20 10:23 ` [PATCH for 2.6.22] [2/10] x86_64: Fix readahead/sync_file_range/fadvise64 compat calls Andi Kleen
2007-06-20 10:23 ` [PATCH for 2.6.22] [3/10] x86_64: Fix eventd/timerfd syscalls Andi Kleen
2007-06-20 10:23 ` [PATCH for 2.6.22] [4/10] x86: Disable DAC on VIA bridges Andi Kleen
2007-06-20 10:23 ` [PATCH for 2.6.22] [5/10] x86_64: Quieten Atari keyboard warnings in Kconfig Andi Kleen
2007-06-20 12:31   ` Roman Zippel
2007-06-20 10:23 ` [PATCH for 2.6.22] [6/10] x86: Only make Macintosh drivers default on Macs Andi Kleen
2007-06-21 17:36   ` Olaf Hering
2007-06-21 17:52     ` Olaf Hering
2007-06-22  6:45       ` Andi Kleen
2007-06-21 17:58     ` Will Schmidt
2007-06-21 18:26       ` Linus Torvalds
2007-06-21 18:54         ` Olaf Hering
2007-06-21 21:09           ` Will Schmidt
2007-06-20 10:23 ` [PATCH for 2.6.22] [7/10] x86: Disable KPROBES with DEBUG_RODATA for now Andi Kleen
2007-06-20 10:23 ` [PATCH for 2.6.22] [8/10] x86: change_page_attr bandaids Andi Kleen
2007-06-20 10:23 ` [PATCH for 2.6.22] [9/10] i386: Disable alternative() patching after boot with DEBUG_RODATA Andi Kleen
2007-06-20 11:55   ` [patches] [PATCH for 2.6.22] [9/10] i386: Disable alternative()patching after boot with DEBUG_RO Jan Beulich
2007-06-20 12:27     ` Andi Kleen
2007-06-20 10:23 ` [PATCH for 2.6.22] [10/10] x86_64: fix link warning between for .text and .init.text Andi Kleen
2007-06-20 12:02   ` [patches] [PATCH for 2.6.22] [10/10] x86_64: fix link warningbetween " Jan Beulich
2007-06-20 12:30     ` Andi Kleen

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=20070620102329.9248A14ACF@wotan.suse.de \
    --to=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@x86-64.org \
    --cc=righiandr@users.sourceforge.net \
    --cc=torvalds@osdl.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