lkml.org 
[lkml]   [2011]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/2] coredump: use task comm instead of (unknown)
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


\
 
 \ /
  Last update: 2011-06-07 20:37    [W:0.100 / U:0.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site