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

[Xen-changelog] [xen staging] x86: make arch_set_info_guest() match comments in load_segments()



commit 520116f7b14e19668cfbc660cd42e8cdc09193cd
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Aug 17 13:51:27 2018 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Aug 17 13:51:27 2018 +0200

    x86: make arch_set_info_guest() match comments in load_segments()
    
    For both fs_base and gs_base_user, there are comments saying "This can
    only be non-zero if selector is NULL." While save_segments() ensures
    this, so far arch_set_info_guest() didn't. Make behavior consistent
    (attaching comments identical to those in save_segments()).
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/domain.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index b5bb0f3b22..5bb900edec 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -931,9 +931,13 @@ int arch_set_info_guest(
     if ( !compat )
     {
         v->arch.pv_vcpu.syscall_callback_eip = c.nat->syscall_callback_eip;
-        v->arch.pv_vcpu.fs_base = c.nat->fs_base;
+        /* non-nul selector kills fs_base */
+        v->arch.pv_vcpu.fs_base =
+            !(v->arch.user_regs.fs & ~3) ? c.nat->fs_base : 0;
         v->arch.pv_vcpu.gs_base_kernel = c.nat->gs_base_kernel;
-        v->arch.pv_vcpu.gs_base_user = c.nat->gs_base_user;
+        /* non-nul selector kills gs_base_user */
+        v->arch.pv_vcpu.gs_base_user =
+            !(v->arch.user_regs.gs & ~3) ? c.nat->gs_base_user : 0;
     }
     else
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
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®.