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

Re: [PATCH] x86/pvh: pass module command line to dom0



On 29.01.2021 10:05, Roger Pau Monne wrote:
> Both the multiboot and the HVM start info structures allow passing a
> string together with a module. Implement the missing support in
> pvh_load_kernel so that module strings found in the multiboot
> structure are forwarded to dom0.
> 
> Fixes: 62ba982424 ('x86: parse Dom0 kernel for PVHv2')

This really is relevant only when it's not an initrd which gets
passed as module, I suppose? I'm not fully convinced I'd call
this a bug then, but perhaps more a missing feature. Which in
turn means I'm not sure about the change's disposition wrt 4.15.
Cc-ing Ian.

> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
Albeit ...

> --- a/xen/arch/x86/hvm/dom0_build.c
> +++ b/xen/arch/x86/hvm/dom0_build.c
> @@ -617,7 +617,21 @@ static int __init pvh_load_kernel(struct domain *d, 
> const module_t *image,
>  
>          mod.paddr = last_addr;
>          mod.size = initrd->mod_end;
> -        last_addr += ROUNDUP(initrd->mod_end, PAGE_SIZE);
> +        last_addr += ROUNDUP(initrd->mod_end, elf_64bit(&elf) ? 8 : 4);
> +        if ( initrd->string )
> +        {
> +            char *str = __va(initrd->string);
> +
> +            rc = hvm_copy_to_guest_phys(last_addr, str, strlen(str) + 1, v);
> +            if ( rc )
> +            {
> +                printk("Unable to copy module command line\n");
> +                return rc;
> +            }
> +            mod.cmdline_paddr = last_addr;
> +            last_addr += strlen(str) + 1;

... it would have been nice if this length was calculated just
once, into a local variable. I'd be fine making the adjustment
while committing, so long as you agree.

Jan



 


Rackspace

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