From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Frank Heckenbach <f.heckenbach@fh-soft.de>,
Neil Horman <nhorman@tuxdriver.com>,
Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] coredump: set ->group_exit_code for other CLONE_VM tasks too
Date: Mon, 8 Feb 2010 18:13:15 +0800 [thread overview]
Message-ID: <2375c9f91002080213n6de036br7690e14294ede27b@mail.gmail.com> (raw)
In-Reply-To: <20100207171615.GA9854@redhat.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 3466 bytes --]
On Mon, Feb 8, 2010 at 1:16 AM, Oleg Nesterov <oleg@redhat.com> wrote:> User visible change.>> do_coredump() kills all threads which share the same ->mm but only> the coredumping process gets the proper exit_code. Other tasks which> share the same ->mm die "silently" and return status == 0 to parent.>> This is historical behaviour, not actually a bug. But I think Frank> Heckenbach rightly dislikes the current behaviour. Simple test-case:>> Â Â Â Â #include <stdio.h>> Â Â Â Â #include <unistd.h>> Â Â Â Â #include <signal.h>> Â Â Â Â #include <sys/wait.h>>> Â Â Â Â int main(void)> Â Â Â Â {> Â Â Â Â Â Â Â Â int stat;>> Â Â Â Â Â Â Â Â if (!fork()) {> Â Â Â Â Â Â Â Â Â Â Â Â if (!vfork())> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â kill(getpid(), SIGQUIT);> Â Â Â Â Â Â Â Â }>> Â Â Â Â Â Â Â Â wait(&stat);> Â Â Â Â Â Â Â Â printf("stat=%x\n", stat);> Â Â Â Â Â Â Â Â return 0;> Â Â Â Â }>> Before this patch it prints "stat=0" despite the fact the child was> killed by SIGQUIT. After this patch the output is "stat=3" which> obviously makes more sense.>> Even with this patch, only the task which originates the coredumping> gets "|= 0x80" if the core was actually dumped, but at least the> coredumping signal is visible to do_wait/etc.
Nice changelog!
>> Reported-by: Frank Heckenbach <f.heckenbach@fh-soft.de>> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Thank you!
> --->>  fs/exec.c |   8 ++++---->  1 file changed, 4 insertions(+), 4 deletions(-)>> --- V1/fs/exec.c~CD_STATUS    2009-12-18 00:20:50.000000000 +0100> +++ V1/fs/exec.c     2010-02-07 17:28:24.000000000 +0100> @@ -1536,12 +1536,13 @@ out:>     return ispipe;>  }>> -static int zap_process(struct task_struct *start)> +static int zap_process(struct task_struct *start, int exit_code)>  {>     struct task_struct *t;>     int nr = 0;>>     start->signal->flags = SIGNAL_GROUP_EXIT;> +    start->signal->group_exit_code = exit_code;>     start->signal->group_stop_count = 0;>>     t = start;> @@ -1566,8 +1567,7 @@ 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);> +        nr = zap_process(tsk, exit_code);>     }>     spin_unlock_irq(&tsk->sighand->siglock);>     if (unlikely(nr < 0))> @@ -1616,7 +1616,7 @@ static inline int zap_threads(struct tas>             if (p->mm) {>                 if (unlikely(p->mm == mm)) {>                     lock_task_sighand(p, &flags);> -                    nr += zap_process(p);> +                    nr += zap_process(p, exit_code);>                     unlock_task_sighand(p, &flags);>                 }>                 break;>>ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2010-02-08 10:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-07 17:16 Oleg Nesterov
2010-02-08 10:13 ` Américo Wang [this message]
2010-02-08 18:06 ` Roland McGrath
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=2375c9f91002080213n6de036br7690e14294ede27b@mail.gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=f.heckenbach@fh-soft.de \
--cc=linux-kernel@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=oleg@redhat.com \
--cc=roland@redhat.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
all inboxes | Powered by JetHome®