From: Oleg Nesterov <oleg@redhat•com>
To: Peter Hurley <peter@hurleysoftware•com>,
Andrew Morton <akpm@linux-foundation•org>
Cc: Sree Harsha Totakura <sreeharsha@totakura•in>,
linux-kernel@vger•kernel.org, netdev@vger•kernel.org,
"Eric W. Biederman" <ebiederm@xmission•com>,
Jeff Dike <jdike@addtoit•com>, Ingo Molnar <mingo@elte•hu>
Subject: [PATCH 1/2] exit: call disassociate_ctty() before exit_task_namespaces()
Date: Mon, 17 Mar 2014 19:04:48 +0100 [thread overview]
Message-ID: <20140317180448.GB15708@redhat.com> (raw)
In-Reply-To: <20140317180416.GA15708@redhat.com>
8aac62706ada "move exit_task_namespaces() outside of exit_notify()"
breaks pppd and the exiting service crashes the kernel:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
IP: [<ffffffffa06985a3>] ppp_register_channel+0x13/0x20 [ppp_generic]
...
Call Trace:
[<ffffffffa06ab2ab>] ? ppp_asynctty_open+0x12b/0x170 [ppp_async]
[<ffffffff812ec907>] ? tty_ldisc_open.isra.2+0x27/0x60
[<ffffffff812ed1d3>] ? tty_ldisc_hangup+0x1e3/0x220
[<ffffffff812e4614>] ? __tty_hangup+0x2c4/0x440
[<ffffffff812e56a1>] ? disassociate_ctty+0x61/0x270
[<ffffffff810483c2>] ? do_exit+0x7f2/0xa50
ppp_register_channel() needs ->net_ns and current->nsproxy == NULL.
Move disassociate_ctty() before exit_task_namespaces(), it doesn't
make sense to delay it after perf_event_exit_task() or cgroup_exit().
This also allows to use task_work_add() inside the (nontrivial) code
paths in disassociate_ctty().
Cc: stable@vger•kernel.org # v3.10+
Reported-by: Sree Harsha Totakura <sreeharsha@totakura•in>
Investigated-by: Peter Hurley <peter@hurleysoftware•com>
Signed-off-by: Oleg Nesterov <oleg@redhat•com>
---
kernel/exit.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index 790b73c..5d5b472 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -784,6 +784,8 @@ void do_exit(long code)
exit_shm(tsk);
exit_files(tsk);
exit_fs(tsk);
+ if (group_dead)
+ disassociate_ctty(1);
exit_task_namespaces(tsk);
exit_task_work(tsk);
check_stack_usage();
@@ -799,13 +801,9 @@ void do_exit(long code)
cgroup_exit(tsk, 1);
- if (group_dead)
- disassociate_ctty(1);
-
module_put(task_thread_info(tsk)->exec_domain->module);
proc_exit_connector(tsk);
-
/*
* FIXME: do that only when needed, using sched_exit tracepoint
*/
--
1.5.5.1
next prev parent reply other threads:[~2014-03-17 18:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <531A37FF.4000509@totakura.in>
2014-03-10 16:56 ` pppd service crash in linux-3.13.6 Sree Harsha Totakura
2014-03-10 19:23 ` Peter Hurley
2014-03-13 17:06 ` Oleg Nesterov
2014-03-13 17:55 ` Peter Hurley
2014-03-14 14:19 ` Peter Hurley
2014-03-14 15:02 ` Peter Hurley
2014-03-14 19:23 ` Oleg Nesterov
2014-03-14 20:28 ` Peter Hurley
2014-03-14 21:04 ` Oleg Nesterov
2014-03-15 12:49 ` Peter Hurley
2014-03-17 18:04 ` [PATCH 0/2] (Was: pppd service crash in linux-3.13.6) Oleg Nesterov
2014-03-17 18:04 ` Oleg Nesterov [this message]
2014-03-17 18:05 ` [PATCH 2/2] exit: move check_stack_usage() to the end of do_exit() Oleg Nesterov
2014-03-10 19:54 ` pppd service crash in linux-3.13.6 Ben Hutchings
2014-03-12 21:25 ` Sree Harsha Totakura
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=20140317180448.GB15708@redhat.com \
--to=oleg@redhat$(echo .)com \
--cc=akpm@linux-foundation$(echo .)org \
--cc=ebiederm@xmission$(echo .)com \
--cc=jdike@addtoit$(echo .)com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=mingo@elte$(echo .)hu \
--cc=netdev@vger$(echo .)kernel.org \
--cc=peter@hurleysoftware$(echo .)com \
--cc=sreeharsha@totakura$(echo .)in \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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