提交 32321137 编写于 作者: N Neil Horman 提交者: Linus Torvalds

core_pattern: fix up a few miscellaneous bugs

Fix do_coredump to detect a crash in the user mode helper process and abort
the attempt to recursively dump core to another copy of the helper process,
potentially ad-infinitum.

[akpm@linux-foundation.org: cleanups]
Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
Cc: <martin.pitt@ubuntu.com>
Cc: <wwoods@redhat.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 74aadce9
...@@ -1762,14 +1762,27 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) ...@@ -1762,14 +1762,27 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
goto fail_unlock; goto fail_unlock;
if (ispipe) { if (ispipe) {
core_limit = RLIM_INFINITY;
helper_argv = argv_split(GFP_KERNEL, corename+1, &helper_argc); helper_argv = argv_split(GFP_KERNEL, corename+1, &helper_argc);
/* Terminate the string before the first option */ /* Terminate the string before the first option */
delimit = strchr(corename, ' '); delimit = strchr(corename, ' ');
if (delimit) if (delimit)
*delimit = '\0'; *delimit = '\0';
delimit = strrchr(helper_argv[0], '/');
if (delimit)
delimit++;
else
delimit = helper_argv[0];
if (!strcmp(delimit, current->comm)) {
printk(KERN_NOTICE "Recursive core dump detected, "
"aborting\n");
goto fail_unlock;
}
core_limit = RLIM_INFINITY;
/* SIGPIPE can happen, but it's just never processed */ /* SIGPIPE can happen, but it's just never processed */
if(call_usermodehelper_pipe(corename+1, helper_argv, NULL, &file)) { if (call_usermodehelper_pipe(corename+1, helper_argv, NULL,
&file)) {
printk(KERN_INFO "Core dump to %s pipe failed\n", printk(KERN_INFO "Core dump to %s pipe failed\n",
corename); corename);
goto fail_unlock; goto fail_unlock;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册