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

Re: [PATCH v2 7/9] x86/svm: VMEntry/Exit logic for MSR_SPEC_CTRL


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 31 Jan 2022 13:55:08 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aB4KGNhgaKfqasPU+NjlvoXn4q6KhPSucs0WPvg5F3M=; b=hK7n9vFJfZICsX/FYetgzLXjv4boPCv3unwugWKUc/6G9lJ9wwHtn7X5CGLFNClOOlg0zyMu4eVD6HtaoK9pj3trG/UOSB6xuWXWMYe77IwwshoEI0vMAGn1KYcV/2NRim3pxl1RBAjYEUXU/7zv9Ly9lRcVP7YslOYD00m12hdWS3ORhdvquw5ssTeSOJWJWk4WxLx6Z1mgM79BtttB/KR9seCgyBD3C256fCCKCkprFiIyqxfdXLbpmkGh2U5R2jwQ391t40B7LcKsWCg95ypKhQaFg+LyPAm6Q0i3wyUim1/OjCw9lguGpSO4aGa+clkJmDV6DiGT7BiGV0loWQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yw3/tO30wlf8QtlJttmQWWLUV2KuN3bLkA2R03Ca/KzOm8Tclge+3G7I8U4BaPZP6EXsIw/bHMmvtkl0PAMxNbAuScyv9ye87UUtB58pL88oJWhurMKoRVxhPGcZrmOAUD3aXfljcwjYC5bn4OPu3ejDGQgB7QqF3OeHq7AGVAo2Sm1uGQ0SFDbP66dvVjkXSSMUIXzAN9RISfy3nvEIxzTQW0yJKlTige3h/cJrY4wRB13aAyr4XfWbH5KFHdLAxBZ6Cf+5FJvW50N98xEQU7OOsCS6zVofITwZ3Lqvw70/CkxKlWnKbDT2h1KcE4X8G94JUdeaDF4myt9mmhmwOg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 31 Jan 2022 12:55:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.01.2022 14:29, Andrew Cooper wrote:
> --- a/xen/arch/x86/hvm/svm/entry.S
> +++ b/xen/arch/x86/hvm/svm/entry.S
> @@ -55,11 +55,12 @@ __UNLIKELY_END(nsvm_hap)
>          mov  %rsp, %rdi
>          call svm_vmenter_helper
>  
> -        mov VCPU_arch_msrs(%rbx), %rax
> -        mov VCPUMSR_spec_ctrl_raw(%rax), %eax
> +        clgi
>  
>          /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
> -        /* SPEC_CTRL_EXIT_TO_SVM   (nothing currently) */
> +        /* SPEC_CTRL_EXIT_TO_SVM       Req:                           Clob: 
> C   */
> +        ALTERNATIVE "", STR(mov %rbx, %rdi; mov %rsp, %rsi), 
> X86_FEATURE_SC_MSR_HVM
> +        ALTERNATIVE "", STR(call vmentry_spec_ctrl), X86_FEATURE_SC_MSR_HVM

Both this and ...

> @@ -86,8 +86,10 @@ __UNLIKELY_END(nsvm_hap)
>  
>          GET_CURRENT(bx)
>  
> -        /* SPEC_CTRL_ENTRY_FROM_SVM    Req: b=curr %rsp=regs/cpuinfo, Clob: 
> ac  */
> +        /* SPEC_CTRL_ENTRY_FROM_SVM    Req:                           Clob: 
> C   */
>          ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
> +        ALTERNATIVE "", STR(mov %rsp, %rdi), X86_FEATURE_SC_MSR_HVM
> +        ALTERNATIVE "", STR(call vmexit_spec_ctrl), X86_FEATURE_SC_MSR_HVM
>          /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */

... this now effectively violate what the warning comment says, as there
is a RET involved in the C call. If this is not a problem for some reason,
I'd like to ask that the comments be updated accordingly.

Jan




 


Rackspace

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