[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E5FBA73.2050108@ixiacom.com>
Date: Thu, 1 Sep 2011 10:01:39 -0700
From: Earl Chew <echew@...acom.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: <alan@...rguk.ukuu.org.uk>, <viro@...iv.linux.org.uk>,
<andi@...stfloor.org>, <oleg@...hat.com>
Subject: [ PATCH 1/1 ] coredump: use current->group_leader->comm instead of
current->comm
Change corepattern %e and %E to use current->group_leader->comm instead of current->comm.
Multithreaded processes can use PR_SET_NAME (or the corresponding pthread_setname_np)
to configure the name of each thread.
A core dump can be triggered from any task in a group, and substituting current->comm
means that the name of the core file for a process can vary in surprising ways.
Using current->group_leader->comm makes the name of the core file more consistent
for a process when used with %e or %E.
Signed-off-by: Earl Chew <echew@...acom.com>
Cc: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: Andi Kleen <andi@...stfloor.org>
Cc: Oleg Nesterov <oleg@...hat.com>
--
--- fs/exec.c.orig 2011-08-28 21:16:01.000000000 -0700
+++ fs/exec.c 2011-09-01 09:58:42.032116998 -0700
@@ -1679,7 +1679,8 @@ static int cn_print_exe_file(struct core
exe_file = get_mm_exe_file(current->mm);
if (!exe_file) {
char *commstart = cn->corename + cn->used;
- ret = cn_printf(cn, "%s (path unknown)", current->comm);
+ ret = cn_printf(cn, "%s (path unknown)",
+ current->group_leader->comm);
cn_escape(commstart);
return ret;
}
@@ -1780,7 +1781,8 @@ static int format_corename(struct core_n
/* executable */
case 'e': {
char *commstart = cn->corename + cn->used;
- err = cn_printf(cn, "%s", current->comm);
+ err = cn_printf(cn, "%s",
+ current->group_leader->comm);
cn_escape(commstart);
break;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists