lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-382005027fedc50b28d40ae64ef1461cca38953e@git.kernel.org>
Date:   Thu, 3 Nov 2016 00:09:47 -0700
From:   tip-bot for Tetsuo Handa <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, tglx@...utronix.de, hpa@...or.com,
        mingo@...nel.org, penguin-kernel@...ove.SAKURA.ne.jp,
        luto@...nel.org, peterz@...radead.org,
        torvalds@...ux-foundation.org
Subject: [tip:sched/urgent] sched/core: Fix oops in sched_show_task()

Commit-ID:  382005027fedc50b28d40ae64ef1461cca38953e
Gitweb:     http://git.kernel.org/tip/382005027fedc50b28d40ae64ef1461cca38953e
Author:     Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
AuthorDate: Wed, 2 Nov 2016 19:50:29 +0900
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Thu, 3 Nov 2016 07:27:34 +0100

sched/core: Fix oops in sched_show_task()

When CONFIG_THREAD_INFO_IN_TASK=y, it is possible that an exited thread
remains in the task list after its stack pointer was already set to NULL.

Therefore, thread_saved_pc() and stack_not_used() in sched_show_task()
will trigger NULL pointer dereference if an attempt to dump such thread's
traces (e.g. SysRq-t, khungtaskd) is made.

Since show_stack() in sched_show_task() calls try_get_task_stack() and
sched_show_task() is called from interrupt context, calling
try_get_task_stack() from sched_show_task() will be safe as well.

Signed-off-by: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Acked-by: Andy Lutomirski <luto@...nel.org>
Acked-by: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: bp@...en8.de
Cc: brgerst@...il.com
Cc: jann@...jh.net
Cc: keescook@...omium.org
Cc: linux-api@...r.kernel.org
Cc: tycho.andersen@...onical.com
Link: http://lkml.kernel.org/r/201611021950.FEJ34368.HFFJOOMLtQOVSF@I-love.SAKURA.ne.jp
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 kernel/sched/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 42d4027..9abf66b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5192,6 +5192,8 @@ void sched_show_task(struct task_struct *p)
 	int ppid;
 	unsigned long state = p->state;
 
+	if (!try_get_task_stack(p))
+		return;
 	if (state)
 		state = __ffs(state) + 1;
 	printk(KERN_INFO "%-15.15s %c", p->comm,
@@ -5221,6 +5223,7 @@ void sched_show_task(struct task_struct *p)
 
 	print_worker_info(KERN_INFO, p);
 	show_stack(p, NULL);
+	put_task_stack(p);
 }
 
 void show_state_filter(unsigned long state_filter)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ