[CRIU] Error (namespaces.c:965): BUG at namespaces.c:965

Tycho Andersen tycho.andersen at canonical.com
Wed Mar 30 10:03:59 PDT 2016


On Wed, Mar 30, 2016 at 06:57:40PM +0200, Stanislav Kinsburskiy wrote:
> Hello,
> 
> There is a commit 85ebf0a83b2a1d1eada1989b33f3208b80507db9, which introduced
> this hunk:
> 
> @@ -918,8 +949,10 @@ static int usernsd(int sk)
>                         return -1;
>                 }
> 
> -               fd = unsc_msg_fd(&um);
> -               pr_debug("UNS: daemon calls %p (%d, %x)\n", call, fd,
> flags);
> +               unsc_msg_pid_fd(&um, &pid, &fd);
> +               pr_debug("UNS: daemon calls %p (%d, %d, %x)\n", call, pid,
> fd, flags);
> +
> +               BUG_ON(fd < 0 && flags & UNS_FDOUT);
> 
>                 /*
>                  * Caller has sent us bare address of the routine it
> 
> Could you, please, explain, what was the reason to prevent returning file
> descriptor, if provided one is negative (BUG_ON)?
> A brief look at the code doesn't explain, why uns can't be used _only_ to
> open some file and return its descriptor.

I think it was probably just that all the calls we have right now use
unsd to set some special bits on an fd that already exists, not to
open a new one, so it was more just to prevent errors in future
callers of forgetting to pass an fd but passing UNS_FDOUT. It should
be safe to remove.

Tycho


More information about the CRIU mailing list