On 19/10/18 15:28, Wei Liu wrote:
> Signed-off-by: Wei Liu <wei.l...@citrix.com>
> ---
> v2: new
> ---
>  xen/arch/x86/x86_64/traps.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
> index 27154f2..2b7ec7d 100644
> --- a/xen/arch/x86/x86_64/traps.c
> +++ b/xen/arch/x86/x86_64/traps.c
> @@ -267,6 +267,7 @@ void do_double_fault(struct cpu_user_regs *regs)
>      panic("DOUBLE FAULT -- system shutdown\n");
>  }
>  
> +#ifdef CONFIG_PV
>  static unsigned int write_stub_trampoline(
>      unsigned char *stub, unsigned long stub_va,
>      unsigned long stack_bottom, unsigned long target_va)
> @@ -296,6 +297,7 @@ static unsigned int write_stub_trampoline(
>      /* Round up to a multiple of 16 bytes. */
>      return 32;
>  }
> +#endif
>  
>  DEFINE_PER_CPU(struct stubs, stubs);
>  void lstar_enter(void);
> @@ -303,14 +305,17 @@ void cstar_enter(void);
>  
>  void subarch_percpu_traps_init(void)
>  {
> +#ifdef CONFIG_PV
>      unsigned long stack_bottom = get_stack_bottom();
>      unsigned long stub_va = this_cpu(stubs.addr);
>      unsigned char *stub_page;
>      unsigned int offset;
> +#endif
>  
>      /* IST_MAX IST pages + at least 1 guard page + primary stack. */
>      BUILD_BUG_ON((IST_MAX + 1) * PAGE_SIZE + PRIMARY_STACK_SIZE > 
> STACK_SIZE);
>  
> +#ifdef CONFIG_PV
>      stub_page = map_domain_page(_mfn(this_cpu(stubs.mfn)));
>  
>      /*
> @@ -347,6 +352,7 @@ void subarch_percpu_traps_init(void)
>      /* Common SYSCALL parameters. */
>      wrmsrl(MSR_STAR, XEN_MSR_STAR);
>      wrmsrl(MSR_SYSCALL_MASK, XEN_SYSCALL_MASK);
> +#endif

It would be a wise precaution to initialise these MSRs to 0 in the !PV
case, so we don't retain stale values.

~Andrew

>  }
>  
>  void hypercall_page_initialise(struct domain *d, void *hypercall_page)


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

Reply via email to