On Wed, Jul 15, 2015 at 3:58 PM, Thomas Meyer <tho...@m3y3r.de> wrote:
> Am Mittwoch, den 15.07.2015, 12:12 +0200 schrieb Richard Weinberger:
>> On Mon, Jul 13, 2015 at 5:12 PM, Thomas Meyer <tho...@m3y3r.de>
>> wrote:
>> > Am Montag, den 13.07.2015, 17:11 +0200 schrieb Richard Weinberger:
>> > > Am 13.07.2015 um 17:08 schrieb Thomas Meyer:
>> > > > Am Montag, den 13.07.2015, 16:41 +0200 schrieb Richard
>> > > > Weinberger:
>> > > > > Am 13.07.2015 um 16:24 schrieb Thomas Meyer:
>> > > > > > > Yeah. And please add a dump_stack() to figure out where
>> > > > > > > it
>> > > > > > > was
>> > > > > > > called.
>> > > > > >
>> > > > > > I think calling dump_stack() somehow changed the errno to
>> > > > > > 25?!
>> > > > >
>> > > > > >
>> > > > > > +extern __attribute__((regparm(0))) void dump_stack(void);
>> > > > >
>> > > > > Hmm, maybe the regparm(0) kills your stack.
>> > > > > Anyway, how do you trigger the issue?
>> > > > > I tried here and don't see any zombie processes?
>> > > > > In my setup I run UML as non-root and tap0 is owned by root.
>> > > > > -> UML is unable to setup eth0.
>> > > > > But no zombies here.
>> > > >
>> > > > I run UML as non-root user, tun is:
>> > > >
>> > > > $ ll /dev/net
>> > > > insgesamt 0
>> > > > crw-rw----. 1 root zml-net 10, 200 13. Jul 14:49 tun
>> > > >
>> > > > $ ll /usr/bin/uml_net
>> > > > -rwsr-x---. 1 root uml-net 31472 19. Aug 2014  /usr/bin/uml_net
>> > >
>> > > And eth0=tuntap,tap?
>> >
>> > yes,
>> >
>> > eth0=tuntap,,,192.168.10.2
>>
>> Sorry for the late reply.
> Hi,
>
> null problemo.
>
>> I'm still burred in work issues and had no time to look in detail at
>> this.
>>
>> But in the meanwhile you can try to gather some more Infos.
>> Remove the dump_stack() and add some printk()s.
>> I'm interested which PIDs are returned and waited for.
>
> Mhh.. I think the pid is already printed in error case:
>
> [   15.930000] helper_wait : waitpid process 11673 failed, errno = 10
> [   15.930000] * modprobe tun
>                * ifconfig tap0 192.168.10.1 netmask 255.255.255.255 up
>                * bash -c echo 1 > /proc/sys/net/ipv4/ip_forward
> [   20.480000] helper_wait : waitpid process 11780 failed, errno = 10
> [   20.480000] * route add -host 192.168.10.2 dev tap0
>                * bash -c echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
>
> pid 11673 and pid 11780 in above case were the two zombie processes.
>
> errno 10 = ECHILD
>
> which can happen for the waitpid() call, according to the man page:
>
>        ECHILD (for  waitpid()  or waitid()) The process specified by pid 
> (waitpid()) or idtype and id (waitid()) does not exist or
>               is not a child of the calling process.  (This can happen for 
> one's own child if the action for  SIGCHLD  is  set  to
>               SIG_IGN.  See also the Linux Notes section about threads.)
>
> I'm not able to completely figure out above meaning, so...
> But maybe ECHILD is returned because uml_net is run with setuid bit
> set?
>
> any ideas?

The attached fix should fix the issue. Please confirm.

-- 
Thanks,
//richard
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index e3ee4a5..3f02d42 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -96,7 +96,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char 
**argv)
                               "ret = %d\n", -n);
                        ret = n;
                }
-               CATCH_EINTR(waitpid(pid, NULL, __WCLONE));
+               CATCH_EINTR(waitpid(pid, NULL, __WALL));
        }
 
 out_free2:
@@ -129,7 +129,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, 
unsigned int flags,
                return err;
        }
        if (stack_out == NULL) {
-               CATCH_EINTR(pid = waitpid(pid, &status, __WCLONE));
+               CATCH_EINTR(pid = waitpid(pid, &status, __WALL));
                if (pid < 0) {
                        err = -errno;
                        printk(UM_KERN_ERR "run_helper_thread - wait failed, "
@@ -148,7 +148,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, 
unsigned int flags,
 int helper_wait(int pid)
 {
        int ret, status;
-       int wflags = __WCLONE;
+       int wflags = __WALL;
 
        CATCH_EINTR(ret = waitpid(pid, &status, wflags));
        if (ret < 0) {
------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to