From: Oleg Nesterov <oleg@redhat.com>
To: "Américo Wang" <xiyou.wangcong@gmail.com>
Cc: Frank Heckenbach <f.heckenbach@fh-soft.de>, linux-kernel@vger.kernel.org
Subject: Re: CLONE_VM: parent terminates silently when child segfaults
Date: Thu, 4 Feb 2010 11:50:17 +0100 [thread overview]
Message-ID: <20100204105017.GA21188@redhat.com> (raw)
In-Reply-To: <2375c9f91002040001t1064c8c9h8990b40b63290dd5@mail.gmail.com>
On 02/04, Américo Wang wrote:
>
> On Thu, Jan 28, 2010 at 4:48 AM, Frank Heckenbach
> <f.heckenbach@fh-soft.de> wrote:
> > When a process cloned with CLONE_VM is killed by SIGSEGV, the parent
> > process is terminated silently.
>
> Becase SIGSEGV and SIGILL are coredump signals, when you use CLONE_VM,
> child process will share the memory space with its parent, what would
> you expect the parent behaves when its child coredumping their shared memory
> space?
Yes, exactly. The coredump signals kill/dump all threads which share
this ->mm, this is intentional.
As for status = 0 I agree, this looks strange. In fact I already
suggested the change below a long ago, but I don't remember why it
was declined (or probably it was unnoticed).
The patch below doesn't add 0x80 to ->group_exit_code in case we
really dumped the core, but at least the coredumping signal is
visible to do_wait/etc.
Oleg.
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1550,6 +1550,7 @@ static int zap_process(struct task_struc
int nr = 0;
start->signal->flags = SIGNAL_GROUP_EXIT;
+ start->signal->group_exit_code = exit_code;
start->signal->group_stop_count = 0;
t = start;
@@ -1574,7 +1575,6 @@ static inline int zap_threads(struct tas
spin_lock_irq(&tsk->sighand->siglock);
if (!signal_group_exit(tsk->signal)) {
mm->core_state = core_state;
- tsk->signal->group_exit_code = exit_code;
nr = zap_process(tsk);
}
spin_unlock_irq(&tsk->sighand->siglock);
prev parent reply other threads:[~2010-02-04 10:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-27 20:48 CLONE_VM: parent terminates silently when child segfaults Frank Heckenbach
2010-02-04 8:01 ` Américo Wang
2010-02-04 10:50 ` Oleg Nesterov [this message]
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=20100204105017.GA21188@redhat.com \
--to=oleg@redhat.com \
--cc=f.heckenbach@fh-soft.de \
--cc=linux-kernel@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/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