[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] libxl: do not overwrite user supplied config when running bootloader



> [...]
> @@ -281,18 +278,35 @@ static void bootloader_abort(libxl__egc
>  void libxl__bootloader_run(libxl__egc *egc, libxl__bootloader_state *bl)
>  {
>      STATE_AO_GC(bl->ao);
> -    libxl_domain_build_info *info = bl->info;
> +    const libxl_domain_build_info *info = bl->info;
>      uint32_t domid = bl->domid;
>      char *logfile_tmp = NULL;
>      int rc, r;
> +    const char *bootloader;
> 
>      libxl__bootloader_init(bl);
> 
> -    if (info->type != LIBXL_DOMAIN_TYPE_PV || !info->u.pv.bootloader) {
> +    if (info->type != LIBXL_DOMAIN_TYPE_PV) {
> +        LOG(DEBUG, "not a PV domain, skipping bootloader");
>          rc = 0;
>          goto out_ok;
>      }
> 
> +    if (!info->u.pv.bootloader) {
> +        LOG(DEBUG, "no bootloader configured, using user supplied kernel");
> +        bl->kernel->path = bl->info->u.pv.kernel;
> +        bl->ramdisk->path = bl->info->u.pv.ramdisk;
> +        bl->cmdline = bl->info->u.pv.cmdline;
> +        rc = 0;
> +        goto out_ok;
> +    }

I'm not at all sure about this. Is it valid for an async operation to
keep references to the parameters from the caller and to use them for
the duration of the operation? IOW is there a requirement that the
caller keeps the arguments live until the op completes? It's seems
obvious that there should but I thought I'd seen a comment to the
contrary somewhere (which I now can't see, perhaps I was thinking about
the lack of a requirement to keep the ao_how valid).

Anyway, I don't think I make this any worse here (the reference to binfo
is pre-existing, this just creates another reference to strings therein,
which are dead by the time the ao completes).

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.