>>> On 07.11.17 at 21:39, <chanud...@ainfosec.com> wrote:
> Do it once at domain creation (hpet_init).
> 
> Sleep -> Resume cycles will end up crashing an HVM guest with hpet as
> the sequence during resume takes the path:
> -> hvm_s3_suspend
>   -> hpet_reset
>     -> hpet_deinit
>     -> hpet_init
>       -> register_mmio_handler
>         -> hvm_next_io_handler
> 
> register_mmio_handler will use a new io handler each time, until
> eventually it reaches NR_IO_HANDLERS, then hvm_next_io_handler calls
> domain_crash.
> 
> Signed-off-by: Eric Chanudet <chanud...@ainfosec.com>

This is certainly worthwhile to consider for 4.10 - please Cc
Julien on v2.

> +void hpet_reinit(struct domain *d)

static

> +{
> +    HPETState *h = domain_vhpet(d);
> +
> +    if ( !has_vhpet(d) )
> +        return;
> +
> +    hpet_set(h);

The local variable, being used only once, isn't needed.

> @@ -698,7 +713,7 @@ void hpet_deinit(struct domain *d)
>  void hpet_reset(struct domain *d)
>  {
>      hpet_deinit(d);
> -    hpet_init(d);
> +    hpet_reinit(d);
>  }

This being the only caller, it then becomes questionable whether
hpet_reinit() needs to be a separate function, or wouldn't better
be inlined here.

Jan


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

Reply via email to