Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752171AbcL3IQI (ORCPT ); Fri, 30 Dec 2016 03:16:08 -0500 Received: from mx5.zte.com.cn ([63.217.80.70]:45714 "EHLO mx5.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751410AbcL3IQH (ORCPT ); Fri, 30 Dec 2016 03:16:07 -0500 X-MAILFROM: X-RCPTTO: X-FROMIP: 10.30.3.20 X-SEG-Scaned: 1 From: Yang Yang To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, jiang.biao2@zte.com.cn, deng.huali@zte.com.cn, jiang.zhengxiong@zte.com.cn, zhong.weidong@zte.com.cn Subject: futex: Ahead futex_init from __initcall to core_initcall Date: Fri, 30 Dec 2016 16:17:55 +0800 Message-Id: <1483085875-6130-1-git-send-email-yang.yang29@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2016-12-30 16:15:56, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2016-12-30 16:15:49, Serialize complete at 2016-12-30 16:15:49 X-MAIL: mse01.zte.com.cn uBU8FnVS035277 X-HQIP: 127.0.0.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2141 Lines: 60 If configs UEVENT_HELPER_PATH [=/sbin/mdev](/sbin/mdev belongs to busybox), the kernel may trigger oops and kill progress "mdev" when booting. The reason is when the init progress is calling do_one_initcall(),devices will be added and trigger /sbin/mdev to execute(in order to make device nodes automatically),then /sbin/mdev will call SyS_futex().But when SyS_futex() visit the global variable futex_queues,it maynot be initalized yet at this time. Ahead futex_init from __initcall to core_initcall will make sure futex_queues is always initalized before the /sbin/mdev executes. See oops below on arm CPU SABER. The bug maynot occur due to different race conditions on different CPUs. But it has a chance to occur by using QUME simulating x86 CPU with kernel linux-4.10-rc1. Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = ed100000 [00000000] *pgd=8e0b1831, *pte=00000000, *ppte=00000000 Internal error: Oops: 17 [#1] ARM Modules linked in: task: ed08b080 ti: ed0ea000 task.ti: ed0ea000 PC is at futex_wake+0x58/0x11c LR is at futex_wake+0x48/0x11c pc : [] lr : [] psr: a0000213 sp : ed0ebe98 ip : bec10000 fp : ed0ebecc r10: 00000000 r9 : 00000001 r8 : 00000000 r7 : c088e700 r6 : ffffffff r5 : 00000001 r4 : 00008114 r3 : 00000000 r2 : c088e700 r1 : 34a81583 r0 : fffffff4 Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 12c53c7d Table: 8e100059 DAC: 00000015 Process mdev (pid: 225, stack limit = 0xed0ea1b0) Backtrace: [] (futex_wake+0x0/0x11c) from [] [] (do_futex+0x0/0x870) from [] [] (SyS_futex+0x0/0x16c) from [] Code: e1a07000 e5903000 e1500003 e243000c (e5934000) Signed-off-by: Yang Yang --- kernel/futex.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index 0842c8c..cdf3650 100755 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -3323,4 +3323,4 @@ static int __init futex_init(void) return 0; } -__initcall(futex_init); +core_initcall(futex_init); -- 1.7.1