mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Yang <yang.yang29@zte.com.cn>
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	[thread overview]
Message-ID: <1483085875-6130-1-git-send-email-yang.yang29@zte.com.cn> (raw)


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 : [<c004baac>]    lr : [<c004ba9c>]    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:
[<c004ba54>] (futex_wake+0x0/0x11c) from [<c004d3dc>]
[<c004d2b8>] (do_futex+0x0/0x870) from [<c004dbb0>] 
[<c004db28>] (SyS_futex+0x0/0x16c) from [<c0009240>]
Code: e1a07000 e5903000 e1500003 e243000c (e5934000)

Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>


---
 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

             reply	other threads:[~2016-12-30  8:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-30  8:17 Yang Yang [this message]
2017-02-13 15:16 ` [tip:locking/urgent] futex: Move futex_init() " tip-bot for Yang Yang

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=1483085875-6130-1-git-send-email-yang.yang29@zte.com.cn \
    --to=yang.yang29@zte.com.cn \
    --cc=deng.huali@zte.com.cn \
    --cc=jiang.biao2@zte.com.cn \
    --cc=jiang.zhengxiong@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=zhong.weidong@zte.com.cn \
    /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

all inboxes | Powered by JetHome®