public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	linux-mm@kvack.org
Subject: [PATCH] mm: Fix boot crash in mm_alloc()
Date: Sun, 29 May 2011 09:22:56 +0200	[thread overview]
Message-ID: <20110529072256.GA20983@elte.hu> (raw)


Would be nice to get the fix below into -rc1 as well, it triggers 
rather easily on bootup when CONFIG_CPUMASK_OFFSTACK is turned on.

	Ingo

---------------------->
>From 59b28833ae328e2206865fb25e61917e738d9696 Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sat, 28 May 2011 08:22:15 +0200
Subject: [PATCH] mm: Fix boot crash in mm_alloc()

Fix CONFIG_CPUMASK_OFFSTACK=y boot crash:

[   12.598405] BUG: unable to handle kernel NULL pointer dereference at   (null)
[   12.600012] IP: [<c11ae035>] find_next_bit+0x55/0xb0
[   12.600012] *pdpt = 0000000000000000 *pde = f000e81af000e81a
[   12.600012] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
[   12.600012] Modules linked in:
[   12.600012]
[   12.600012] Pid: 1, comm: swapper Not tainted 2.6.39-05707-gde03c72-dirty #130523 System manufacturer System Product Name/A8N-E
[   12.600012] EIP: 0060:[<c11ae035>] EFLAGS: 00010202 CPU: 0
[   12.600012] EIP is at find_next_bit+0x55/0xb0
[   12.600012] EAX: 00000000 EBX: 00000002 ECX: 00000000 EDX: 00000000
[   12.600012] ESI: 00000000 EDI: f59a4000 EBP: f6479e78 ESP: f6479e70
[   12.600012]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
[   12.600012] Process swapper (pid: 1, ti=f6478000 task=f6470000 task.ti=f6478000)
[   12.600012] Stack:
[   12.600012]  00000000 00000000 f6479e8c c11addda 00000000 f59a4000 f5939000 f6479e98
[   12.600012]  c102396b 35937001 f6479eac c1022705 00000001 f5939008 f59a4000 f6479ed8
[   12.600012]  c10227ba f5939000 f59a4000 f5939000 f5937000 f5938000 f593c000 f59a4000
[   12.600012] Call Trace:
[   12.600012]  [<c11addda>] cpumask_any_but+0x2a/0x70
[   12.600012]  [<c102396b>] flush_tlb_mm+0x2b/0x80
[   12.600012]  [<c1022705>] pud_populate+0x35/0x50
[   12.600012]  [<c10227ba>] pgd_alloc+0x9a/0xf0
[   12.600012]  [<c103a3fc>] mm_init+0xec/0x120
[   12.600012]  [<c103a7a3>] mm_alloc+0x53/0xd0
[   12.600012]  [<c10f9220>] bprm_mm_init+0x20/0x1b0
[   12.600012]  [<c10370bf>] ? sched_exec+0x7f/0xb0
[   12.600012]  [<c10f96b9>] do_execve+0xb9/0x270
[   12.600012]  [<c100aec7>] sys_execve+0x37/0x70
[   12.600012]  [<c13d60a2>] ptregs_execve+0x12/0x18
[   12.600012]  [<c13d5299>] ? syscall_call+0x7/0xb
[   12.600012]  [<c1006840>] ? kernel_execve+0x20/0x30
[   12.600012]  [<c16086af>] ? start_kernel+0x2de/0x2de
[   12.600012]  [<c13c9ea2>] ? run_init_process+0x1c/0x1e
[   12.600012]  [<c13c9f2d>] ? init_post+0x89/0xb3
[   12.600012]  [<c16087d1>] ? kernel_init+0x122/0x122
[   12.600012]  [<c13d657a>] ? kernel_thread_helper+0x6/0x10

Caused by:

  de03c72: mm: convert mm->cpu_vm_cpumask into cpumask_var_t

Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/fork.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index ca406d9..7b0669f 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -538,17 +538,13 @@ struct mm_struct * mm_alloc(void)
 		return NULL;
 
 	memset(mm, 0, sizeof(*mm));
-	mm = mm_init(mm, current);
-	if (!mm)
-		return NULL;
 
 	if (mm_init_cpumask(mm, NULL)) {
-		mm_free_pgd(mm);
 		free_mm(mm);
 		return NULL;
 	}
 
-	return mm;
+	return mm_init(mm, current);
 }
 
 /*

             reply	other threads:[~2011-05-29  7:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-29  7:22 Ingo Molnar [this message]
2011-05-29 16:22 ` [PATCH] mm: Fix boot crash in mm_alloc() Linus Torvalds
2011-05-29 17:19   ` Linus Torvalds
2011-05-29 18:43     ` Linus Torvalds
2011-05-30  1:12       ` KOSAKI Motohiro
2011-05-30  8:14         ` Ingo Molnar

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=20110529072256.GA20983@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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