mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>, lkml <linux-kernel@vger.kernel.org>,
	systemtap <systemtap@sources.redhat.com>,
	DLE <dle-develop@lists.sourceforge.net>
Subject: Re: [PATCH -tip 2/3] Add coredump tracepoint
Date: Fri, 13 Nov 2009 15:39:12 -0800 (PST)	[thread overview]
Message-ID: <20091113233912.192A3100E@magilla.sf.frob.com> (raw)
In-Reply-To: Masami Hiramatsu's message of  Friday, 13 November 2009 17:52:34 -0500 <20091113225233.15079.41600.stgit@harusame>

I can't really see what this has to do with "sched" to warrant that name.
But, whatever.

Note that you put the tracepoint where it won't get called in the various
cases where no dump is really being made because of RLIMIT_CORE or file
failures.  I suspect you would like to get those reported.  (Perhaps
especially so, since there won't be any file around to notice later.)

Also, it seems nice to give the tracepoint the chance to look at the actual
open file in case a fancy one wants to do that.

e.g.

diff --git a/fs/exec.c b/fs/exec.c
index ba112bd..0000000 100644  
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1822,9 +1822,7 @@ void do_coredump(long signr, int exit_co
 	ispipe = format_corename(corename, signr);
 	unlock_kernel();
 
-	if ((!ispipe) && (core_limit < binfmt->min_coredump))
-		goto fail_unlock;
-
+	file = NULL;
  	if (ispipe) {
 		if (core_limit == 0) {
 			/*
@@ -1845,7 +1843,7 @@ void do_coredump(long signr, int exit_co
 				"Process %d(%s) has RLIMIT_CORE set to 0\n",
 				task_tgid_vnr(current), current->comm);
 			printk(KERN_WARNING "Aborting core\n");
-			goto fail_unlock;
+			goto nopipe;
 		}
 
 		dump_count = atomic_inc_return(&core_dump_count);
@@ -1853,14 +1851,14 @@ void do_coredump(long signr, int exit_co
 			printk(KERN_WARNING "Pid %d(%s) over core_pipe_limit\n",
 			       task_tgid_vnr(current), current->comm);
 			printk(KERN_WARNING "Skipping core dump\n");
-			goto fail_dropcount;
+			goto nopipe;
 		}
 
 		helper_argv = argv_split(GFP_KERNEL, corename+1, &helper_argc);
 		if (!helper_argv) {
 			printk(KERN_WARNING "%s failed to allocate memory\n",
 			       __func__);
-			goto fail_dropcount;
+			goto nopipe;
 		}
 
 		core_limit = RLIM_INFINITY;
@@ -1870,13 +1868,19 @@ void do_coredump(long signr, int exit_co
 				&file)) {
  			printk(KERN_INFO "Core dump to %s pipe failed\n",
 			       corename);
-			goto fail_dropcount;
+			goto nopipe;
  		}
- 	} else
+ 	} else if (core_limit >= binfmt->min_coredump) {
  		file = filp_open(corename,
 				 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
 				 0600);
-	if (IS_ERR(file))
+	}
+
+nopipe:
+	trace_process_coredump((int) signr, core_limit, mm_flags,
+			       corename, file);
+
+	if (!file || IS_ERR(file))
 		goto fail_dropcount;
 	inode = file->f_path.dentry->d_inode;
 	if (inode->i_nlink > 1)

  reply	other threads:[~2009-11-13 23:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-13 22:52 [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency Masami Hiramatsu
2009-11-13 22:52 ` [PATCH -tip 2/3] Add coredump tracepoint Masami Hiramatsu
2009-11-13 23:39   ` Roland McGrath [this message]
2009-11-14  0:00     ` Masami Hiramatsu
2009-11-14  0:02     ` Ingo Molnar
2009-11-14  0:06       ` Roland McGrath
2009-11-14  0:14         ` Ingo Molnar
2009-11-14  1:49           ` Roland McGrath
2009-11-14  0:25         ` Masami Hiramatsu
2009-11-13 22:52 ` [PATCH -tip 3/3] Add get_signal tracepoint Masami Hiramatsu
2009-11-13 23:53   ` Roland McGrath
2009-11-14  0:10     ` Ingo Molnar
2009-11-16 21:51       ` Masami Hiramatsu
2009-11-16 22:09         ` Roland McGrath
2009-11-16 22:39           ` Masami Hiramatsu
2009-11-16 23:00             ` Roland McGrath
2009-11-16 23:45               ` Masami Hiramatsu
2009-11-17  6:01         ` Ingo Molnar
2009-11-17 15:26           ` Masami Hiramatsu
2009-11-14  0:29     ` Masami Hiramatsu
2009-11-13 23:09 ` [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency Andrew Morton
2009-11-13 23:24   ` Ingo Molnar
2009-11-13 23:44     ` Masami Hiramatsu
2009-11-13 23:16 ` Roland McGrath
2009-11-13 23:23   ` Ingo Molnar
2009-11-13 23:29     ` 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=20091113233912.192A3100E@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=dle-develop@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=systemtap@sources.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®