Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751840Ab1E2HXM (ORCPT ); Sun, 29 May 2011 03:23:12 -0400 Received: from mx3.mail.elte.hu ([157.181.1.138]:55069 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751455Ab1E2HXK (ORCPT ); Sun, 29 May 2011 03:23:10 -0400 Date: Sun, 29 May 2011 09:22:56 +0200 From: Ingo Molnar To: Andrew Morton , Linus Torvalds , Thomas Gleixner , KOSAKI Motohiro Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , linux-mm@kvack.org Subject: [PATCH] mm: Fix boot crash in mm_alloc() Message-ID: <20110529072256.GA20983@elte.hu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) X-ELTE-SpamScore: -2.0 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-2.0 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.3.1 -2.0 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3525 Lines: 91 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 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: [] 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:[] 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] [] cpumask_any_but+0x2a/0x70 [ 12.600012] [] flush_tlb_mm+0x2b/0x80 [ 12.600012] [] pud_populate+0x35/0x50 [ 12.600012] [] pgd_alloc+0x9a/0xf0 [ 12.600012] [] mm_init+0xec/0x120 [ 12.600012] [] mm_alloc+0x53/0xd0 [ 12.600012] [] bprm_mm_init+0x20/0x1b0 [ 12.600012] [] ? sched_exec+0x7f/0xb0 [ 12.600012] [] do_execve+0xb9/0x270 [ 12.600012] [] sys_execve+0x37/0x70 [ 12.600012] [] ptregs_execve+0x12/0x18 [ 12.600012] [] ? syscall_call+0x7/0xb [ 12.600012] [] ? kernel_execve+0x20/0x30 [ 12.600012] [] ? start_kernel+0x2de/0x2de [ 12.600012] [] ? run_init_process+0x1c/0x1e [ 12.600012] [] ? init_post+0x89/0xb3 [ 12.600012] [] ? kernel_init+0x122/0x122 [ 12.600012] [] ? kernel_thread_helper+0x6/0x10 Caused by: de03c72: mm: convert mm->cpu_vm_cpumask into cpumask_var_t Cc: KOSAKI Motohiro Cc: Andrew Morton Cc: Linus Torvalds Signed-off-by: Ingo Molnar --- 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); } /* -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/