Re: call_usermodehelper does not report exit status?
From: Chris Wright
Date: Thu Sep 25 2003 - 13:44:42 EST
* Milton D. Miller II (miltonm@xxxxxxxxxxxx) wrote:
> Andrew Morton <akpm@xxxxxxxx> wrote:
> > This might fix it.
>
> I think you missed the why behind the comment just above your first change.
Anything wrong with just setting a SIG_DFL handler? W.R.T. the kernel
pointer, either Andrew's patch which does put_user/__put_user depending
on context, or some ugly set_fs() should work. This simplistic approach
works for me, thoughts?
thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
--- linux-2.6.0-test5-mm4/kernel/kmod.c 2003-09-08 12:49:59.000000000 -0700
+++ 2.6.0-test5-mm4/kernel/kmod.c 2003-09-25 11:34:59.000000000 -0700
@@ -181,16 +181,24 @@
{
struct subprocess_info *sub_info = data;
pid_t pid;
+ struct k_sigaction sa;
+
+ sa.sa.sa_handler = SIG_DFL;
+ sa.sa.sa_flags = 0;
+ siginitset(&sa.sa.sa_mask, sigmask(SIGCHLD));
+ do_sigaction(SIGCHLD, &sa, (struct k_sigaction *)0);
sub_info->retval = 0;
pid = kernel_thread(____call_usermodehelper, sub_info, SIGCHLD);
if (pid < 0)
sub_info->retval = pid;
- else
- /* 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);
+ else {
+ mm_segment_t old_fs;
+ old_fs = get_fs();
+ set_fs(KERNEL_DS);
+ sys_wait4(pid, &sub_info->retval, 0, NULL);
+ set_fs(old_fs);
+ }
complete(sub_info->complete);
return 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/