From: Andrew Morton <akpm@osdl.org>
To: Omen Wild <Omen.Wild@Dartmouth.EDU>
Cc: linux-kernel@vger.kernel.org
Subject: Re: call_usermodehelper does not report exit status?
Date: Fri, 19 Sep 2003 11:21:48 -0700 [thread overview]
Message-ID: <20030919112148.42adf179.akpm@osdl.org> (raw)
In-Reply-To: <20030919162422.GB2236@descolada.dartmouth.edu>
Omen Wild <Omen.Wild@Dartmouth.EDU> wrote:
>
> I found the call_usermodehelper function and
> call it with the wait flag set, but I cannot get a non-zero return
> status of the program to propagate into the kernel.
This might fix it.
25-akpm/kernel/exit.c | 21 +++++++++++++++++----
25-akpm/kernel/kmod.c | 2 +-
2 files changed, 18 insertions(+), 5 deletions(-)
diff -puN kernel/kmod.c~call_usermodehelper-retval-fix kernel/kmod.c
--- 25/kernel/kmod.c~call_usermodehelper-retval-fix Fri Sep 19 11:14:47 2003
+++ 25-akpm/kernel/kmod.c Fri Sep 19 11:20:14 2003
@@ -190,7 +190,7 @@ static int wait_for_helper(void *data)
/* We don't have a SIGCHLD signal handler, so this
* always returns -ECHILD, but the important thing is
* that it blocks. */
- sys_wait4(pid, NULL, 0, NULL);
+ sys_wait4(pid, &sub_info->retval, 0, NULL);
complete(sub_info->complete);
return 0;
diff -puN kernel/exit.c~call_usermodehelper-retval-fix kernel/exit.c
--- 25/kernel/exit.c~call_usermodehelper-retval-fix Fri Sep 19 11:16:59 2003
+++ 25-akpm/kernel/exit.c Fri Sep 19 11:20:10 2003
@@ -883,10 +883,17 @@ static int wait_task_zombie(task_t *p, u
retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
if (!retval && stat_addr) {
+ int stat;
+
if (p->signal->group_exit)
- retval = put_user(p->signal->group_exit_code, stat_addr);
+ stat = p->signal->group_exit_code;
+ else
+ stat = p->exit_code;
+
+ if (current->mm)
+ retval = put_user(stat, stat_addr);
else
- retval = put_user(p->exit_code, stat_addr);
+ retval = __put_user(stat, stat_addr);
}
if (retval) {
p->state = TASK_ZOMBIE;
@@ -987,8 +994,14 @@ static int wait_task_stopped(task_t *p,
write_unlock_irq(&tasklist_lock);
retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
- if (!retval && stat_addr)
- retval = put_user((exit_code << 8) | 0x7f, stat_addr);
+ if (!retval && stat_addr) {
+ int stat = (exit_code << 8) | 0x7f;
+
+ if (current->mm)
+ retval = put_user(stat, stat_addr);
+ else
+ retval = __put_user(stat, stat_addr);
+ }
if (!retval)
retval = p->pid;
put_task_struct(p);
_
next prev parent reply other threads:[~2003-09-19 18:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-19 16:24 Omen Wild
2003-09-19 18:21 ` Andrew Morton [this message]
2003-09-19 19:51 ` Omen Wild
2003-09-19 19:42 ` Andrew Morton
2003-09-20 18:55 ` Milton D. Miller II
2003-09-25 18:41 ` Chris Wright
2003-09-25 19:05 ` Andrew Morton
2003-09-25 19:38 ` Chris Wright
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=20030919112148.42adf179.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=Omen.Wild@Dartmouth.EDU \
--cc=linux-kernel@vger.kernel.org \
/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®