[SRU][Xenial][PATCH] UBUNTU: SAUCE: Restore the IBRS host state on VMEXIT

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU][Xenial][PATCH] UBUNTU: SAUCE: Restore the IBRS host state on VMEXIT

Juerg Haefliger
BugLink: https://bugs.launchpad.net/bugs/1764956

IBRS in Ubuntu can be controlled dynamically from userspace. Make sure
the correct state is restored on VMEXIT.

Suggested-by: Gavin Guo <[hidden email]>
Signed-off-by: Juerg Haefliger <[hidden email]>
---
 arch/x86/kernel/cpu/bugs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 15867c20ed1c..63d5b84e680b 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -189,6 +189,10 @@ x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool setguest)
  if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD))
  hostval |= ssbd_tif_to_spec_ctrl(ti->flags);
 
+ /* IBRS dynamically controlled in MSR_SPEC_CTRL */
+ if (ibrs_enabled)
+ hostval |= SPEC_CTRL_IBRS;
+
  if (hostval != guestval) {
  msrval = setguest ? guestval : hostval;
  wrmsrl(MSR_IA32_SPEC_CTRL, msrval);
--
2.19.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [SRU][Xenial][PATCH] UBUNTU: SAUCE: Restore the IBRS host state on VMEXIT

Colin Ian King-2
On 15/01/2019 08:33, Juerg Haefliger wrote:

> BugLink: https://bugs.launchpad.net/bugs/1764956
>
> IBRS in Ubuntu can be controlled dynamically from userspace. Make sure
> the correct state is restored on VMEXIT.
>
> Suggested-by: Gavin Guo <[hidden email]>
> Signed-off-by: Juerg Haefliger <[hidden email]>
> ---
>  arch/x86/kernel/cpu/bugs.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 15867c20ed1c..63d5b84e680b 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -189,6 +189,10 @@ x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool setguest)
>   if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD))
>   hostval |= ssbd_tif_to_spec_ctrl(ti->flags);
>  
> + /* IBRS dynamically controlled in MSR_SPEC_CTRL */
> + if (ibrs_enabled)
> + hostval |= SPEC_CTRL_IBRS;
> +
>   if (hostval != guestval) {
>   msrval = setguest ? guestval : hostval;
>   wrmsrl(MSR_IA32_SPEC_CTRL, msrval);
>

Makes sense.

Acked-by: Colin Ian King <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [SRU][Xenial][PATCH] UBUNTU: SAUCE: Restore the IBRS host state on VMEXIT

Gavin Guo
In reply to this post by Juerg Haefliger
On Tue, Jan 15, 2019 at 4:33 PM Juerg Haefliger
<[hidden email]> wrote:

>
> BugLink: https://bugs.launchpad.net/bugs/1764956
>
> IBRS in Ubuntu can be controlled dynamically from userspace. Make sure
> the correct state is restored on VMEXIT.
>
> Suggested-by: Gavin Guo <[hidden email]>
> Signed-off-by: Juerg Haefliger <[hidden email]>
> ---
>  arch/x86/kernel/cpu/bugs.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 15867c20ed1c..63d5b84e680b 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -189,6 +189,10 @@ x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool setguest)
>                 if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD))
>                         hostval |= ssbd_tif_to_spec_ctrl(ti->flags);
>
> +               /* IBRS dynamically controlled in MSR_SPEC_CTRL */
> +               if (ibrs_enabled)
> +                       hostval |= SPEC_CTRL_IBRS;
> +
>                 if (hostval != guestval) {
>                         msrval = setguest ? guestval : hostval;
>                         wrmsrl(MSR_IA32_SPEC_CTRL, msrval);
> --
> 2.19.1
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

The kernel with the patch based on version v4.4.0-141.167 has been
tested[1] and the bug cannot be reproduced.
[1]. https://kernel.ubuntu.com/~juergh/lp1764956/

Acked-by: Gavin Guo <[hidden email]>
Tested-by: Gavin Guo <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED: [SRU][Xenial][PATCH] UBUNTU: SAUCE: Restore the IBRS host state on VMEXIT

Stefan Bader-2
In reply to this post by Juerg Haefliger
On 15.01.19 09:33, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/1764956
>
> IBRS in Ubuntu can be controlled dynamically from userspace. Make sure
> the correct state is restored on VMEXIT.
>
> Suggested-by: Gavin Guo <[hidden email]>
> Signed-off-by: Juerg Haefliger <[hidden email]>
> ---
Applied to xenial/master-next. Thanks.

-Stefan

>  arch/x86/kernel/cpu/bugs.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 15867c20ed1c..63d5b84e680b 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -189,6 +189,10 @@ x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool setguest)
>   if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD))
>   hostval |= ssbd_tif_to_spec_ctrl(ti->flags);
>  
> + /* IBRS dynamically controlled in MSR_SPEC_CTRL */
> + if (ibrs_enabled)
> + hostval |= SPEC_CTRL_IBRS;
> +
>   if (hostval != guestval) {
>   msrval = setguest ? guestval : hostval;
>   wrmsrl(MSR_IA32_SPEC_CTRL, msrval);
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (849 bytes) Download Attachment