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

[Xen-changelog] [xen master] x86/spec_ctrl: Fix determination of when to use IBRS



commit 30cbd0c83ef3d0edac2d5bcc41a9a2b7a843ae58
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Feb 6 13:45:17 2018 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Feb 6 18:32:58 2018 +0000

    x86/spec_ctrl: Fix determination of when to use IBRS
    
    The original version of this logic was:
    
        /*
         * On Intel hardware, we'd like to use retpoline in preference to
         * IBRS, but only if it is safe on this hardware.
         */
        else if ( boot_cpu_has(X86_FEATURE_IBRSB) )
        {
            if ( retpoline_safe() )
                thunk = THUNK_RETPOLINE;
            else
                ibrs = true;
        }
    
    but it was changed by a request during review.  Sadly, the result is buggy 
as
    it breaks the later fallback logic by allowing IBRS to appear as available
    when in fact it isn't.
    
    This in practice means that on repoline-unsafe hardware without IBRS, we
    select THUNK_JUMP despite intending to select THUNK_RETPOLINE.
    
    Reported-by: Zhenzhong Duan <zhenzhong.duan@xxxxxxxxxx>
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/spec_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index f10ffbf..725626b 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -223,7 +223,7 @@ void __init init_speculation_mitigations(void)
              */
             else if ( retpoline_safe() )
                 thunk = THUNK_RETPOLINE;
-            else
+            else if ( boot_cpu_has(X86_FEATURE_IBRSB) )
                 ibrs = true;
         }
         /* Without compiler thunk support, use IBRS if available. */
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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