All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Jiri Slaby <jslaby@suse.cz>,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Andi Kleen <andi@firstfloor.org>
Subject: Re: [PATCH v2 1/2] coredump: use task comm instead of (unknown)
Date: Tue, 07 Jun 2011 20:30:11 +0200	[thread overview]
Message-ID: <4DEE6E33.6020701@gmail.com> (raw)
In-Reply-To: <20110607181607.GA3732@redhat.com>

On 06/07/2011 08:16 PM, Oleg Nesterov wrote:
> On 06/07, Jiri Slaby wrote:
>>
>> @@ -1631,7 +1631,7 @@ static int cn_print_exe_file(struct core_name *cn)
>>
>>  	exe_file = get_mm_exe_file(current->mm);
>>  	if (!exe_file)
>> -		return cn_printf(cn, "(unknown)");
>> +		return cn_printf(cn, "%s (path unknown)", current->comm);
> 
> Hmm. The patch itself looks fine to me.
> 
> Acked-by: Oleg Nesterov <oleg@redhat.com>
> 
> 
> 
> But the code looks wrong.
> 
> What if d_path() fails with, say, ENAMETOOLONG? do_coredump() doesn't
> expect an error code != ENOMEM. This is just ugly, I'll send the simple
> fix. Anyway, if we are changing cn_print_exe_file(), perhaps it makes
> sense to fallback if d_path fails too?

Ah, I see. Perhaps it should check '< 0' instead of '== -ENOMEM' and
print the error in that case?

> And, I am just noticed...
> 
> 	for (p = path; *p; p++)
> 		if (*p == '/')
> 			*p = '!';
> 
> Why??? I am not arguing, just curious.

In fact the reason is in the patch 2/2:
    coredump: escape / in hostname and comm

    Change every occurence of / in comm and hostname to !. If the process
    changes its name to contain /, the core is not dumped (if the
    directory tree doesn't exist like that). The same with hostname being
    something like myhost/3. Fix this behaviour by using the escape loop
    used in %E. (We extract it to a separate function.)

    Now both with comm == myprocess/1 and hostname == myhost/1, the core
    is dumped like (kernel.core_pattern='core.%p.%e.%h):
    core.2349.myprocess!1.myhost!1

thanks,
-- 
js

  reply	other threads:[~2011-06-07 18:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07 14:30 [PATCH v2 1/2] coredump: use task comm instead of (unknown) Jiri Slaby
2011-06-07 14:30 ` [PATCH v2 2/2] coredump: escape / in hostname and comm Jiri Slaby
2011-08-30 15:21   ` Earl Chew
2011-06-07 18:16 ` [PATCH v2 1/2] coredump: use task comm instead of (unknown) Oleg Nesterov
2011-06-07 18:30   ` Jiri Slaby [this message]
2011-06-08 19:26     ` Oleg Nesterov
2011-06-07 18:35   ` [PATCH] do_coredump: fix the "ispipe" error check Oleg Nesterov
2011-06-07 19:00     ` Jiri Slaby
2011-06-07 19:07     ` Neil Horman

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=4DEE6E33.6020701@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andi@firstfloor.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.