[libvirt] [PATCH] LXC: Check container init path after pivot_root()

Gao feng gaofeng at cn.fujitsu.com
Fri Jun 14 07:26:54 UTC 2013


On 06/14/2013 02:53 PM, Richard Weinberger wrote:
> Currently we check the path before changing the root directory.
> This cannot work. Do the check after pivot_root() such that
> we check for the patch within the correct root.
> 

Ok, I know why...

This bug is introduced by my patchset, I'm trying to find out
the problem without my patchset...

Since My patchset hasn't been accepted by the upstream,
I think you should mention this patch is based on my "user namespace
support" patch.

Daniel, Have you finished the test of my patchset?
or you found some problems?
If you think it is ok and intend to accept my patchset,plese accept
this patch too.

Thanks!

> Signed-off-by: Richard Weinberger <richard at nod.at>
> ---
>  src/lxc/lxc_container.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> index a003ec8..7531fea 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -1948,13 +1948,6 @@ static int lxcContainerChild(void *data)
>      if (lxcContainerResolveSymlinks(vmDef) < 0)
>          goto cleanup;
>  
> -    if (!virFileExists(vmDef->os.init)) {
> -        virReportSystemError(errno,
> -                    _("cannot find init path '%s' relative to container root"),
> -                    vmDef->os.init);
> -        goto cleanup;
> -    }
> -
>      /* Wait for interface devices to show up */
>      if (lxcContainerWaitForContinue(argv->monitor) < 0) {
>          virReportSystemError(errno, "%s",
> @@ -1996,6 +1989,13 @@ static int lxcContainerChild(void *data)
>                                     argv->securityDriver) < 0)
>          goto cleanup;
>  
> +    if (!virFileExists(vmDef->os.init)) {
> +        virReportSystemError(errno,
> +                    _("cannot find init path '%s' relative to container root"),
> +                    vmDef->os.init);
> +        goto cleanup;
> +    }
> +
>      /* rename and enable interfaces */
>      if (lxcContainerRenameAndEnableInterfaces(!!(vmDef->features &
>                                                   (1 << VIR_DOMAIN_FEATURE_PRIVNET)),
> 




More information about the libvir-list mailing list