From: Neil Horman <nhorman@tuxdriver.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
jeremy@goop.org, martin.pitt@ubuntu.com, wwoods@redhat.com
Cc: nhorman@tuxdriver.com
Subject: [PATCH 3/3] core_pattern: fix up a few miscelaneous bugs
Date: Fri, 27 Jul 2007 16:13:57 -0400 [thread overview]
Message-ID: <20070727201357.GD18946@hmsreliant.homelinux.net> (raw)
Hey
This patch fixes up a few bugs I found while testing my other work.
Specifically:
1) Fixes call_usermodehelper_pipe to not wait for program exit on the user mode
helper process. Since this context fill the pipe. The user mode helper, if it
reads stdin, will block waiting for the pipe to have data on it, and we will
wait forever for the usermodehelper to exit. Changed this to wait only for a
successful exec.
2) Fixes 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.
Thanks & Regards
Neil
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
fs/exec.c | 14 +++++++++++++-
kernel/kmod.c | 2 +-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/fs/exec.c b/fs/exec.c
index 6855a52..1398d07 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1791,12 +1791,24 @@
goto fail_unlock;
if (ispipe) {
- core_limit = RLIM_INFINITY;
helper_argv = argv_split(GFP_KERNEL, corename+1, &helper_argc);
/* Terminate the string before the first option */
delimit = strchr(corename, ' ');
if (delimit)
*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 */
if(call_usermodehelper_pipe(corename+1, helper_argv, NULL, &file)) {
printk(KERN_INFO "Core dump to %s pipe failed\n",
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 9809cc1..c6a4f8a 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -505,7 +505,7 @@
if (ret < 0)
goto out;
- return call_usermodehelper_exec(sub_info, 1);
+ return call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC);
out:
call_usermodehelper_freeinfo(sub_info);
--
/***************************************************
*Neil Horman
*Software Engineer
*Red Hat, Inc.
*nhorman@tuxdriver.com
*gpg keyid: 1024D / 0x92A74FA1
*http://pgp.mit.edu
***************************************************/
next reply other threads:[~2007-07-27 20:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-27 20:13 Neil Horman [this message]
2007-07-29 13:03 ` Eugene Teo
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=20070727201357.GD18946@hmsreliant.homelinux.net \
--to=nhorman@tuxdriver.com \
--cc=akpm@linux-foundation.org \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.pitt@ubuntu.com \
--cc=wwoods@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®