Commit 6409324b authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

coredump: format_corename: don't append .%pid if multi-threaded

If the coredumping is multi-threaded, format_corename() appends .%pid to
the corename.  This was needed before the proper multi-thread core dump
support, now all the threads in the mm go into a single unified core file.

Remove this special case, it is not even documented and we have "%p"
and core_uses_pid.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: Michael Kerrisk <mtk.manpages@googlemail.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Roland McGrath <roland@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: La Monte Yarroll <piggy@laurelnetworks.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b747c8c1
...@@ -1386,7 +1386,7 @@ EXPORT_SYMBOL(set_binfmt); ...@@ -1386,7 +1386,7 @@ EXPORT_SYMBOL(set_binfmt);
* name into corename, which must have space for at least * name into corename, which must have space for at least
* CORENAME_MAX_SIZE bytes plus one byte for the zero terminator. * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
*/ */
static int format_corename(char *corename, int nr_threads, long signr) static int format_corename(char *corename, long signr)
{ {
const char *pat_ptr = core_pattern; const char *pat_ptr = core_pattern;
int ispipe = (*pat_ptr == '|'); int ispipe = (*pat_ptr == '|');
...@@ -1493,8 +1493,7 @@ static int format_corename(char *corename, int nr_threads, long signr) ...@@ -1493,8 +1493,7 @@ static int format_corename(char *corename, int nr_threads, long signr)
* If core_pattern does not include a %p (as is the default) * If core_pattern does not include a %p (as is the default)
* and core_uses_pid is set, then .%pid will be appended to * and core_uses_pid is set, then .%pid will be appended to
* the filename. Do not do this for piped commands. */ * the filename. Do not do this for piped commands. */
if (!ispipe && !pid_in_pattern if (!ispipe && !pid_in_pattern && core_uses_pid) {
&& (core_uses_pid || nr_threads)) {
rc = snprintf(out_ptr, out_end - out_ptr, rc = snprintf(out_ptr, out_end - out_ptr,
".%d", task_tgid_vnr(current)); ".%d", task_tgid_vnr(current));
if (rc > out_end - out_ptr) if (rc > out_end - out_ptr)
...@@ -1757,7 +1756,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) ...@@ -1757,7 +1756,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
* uses lock_kernel() * uses lock_kernel()
*/ */
lock_kernel(); lock_kernel();
ispipe = format_corename(corename, retval, signr); ispipe = format_corename(corename, signr);
unlock_kernel(); unlock_kernel();
/* /*
* Don't bother to check the RLIMIT_CORE value if core_pattern points * Don't bother to check the RLIMIT_CORE value if core_pattern points
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment